Object Required Error

Object Required Error

am 28.02.2005 04:48:57 von westernnord

I am getting the following error:
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'objReq.SelectSingleNode(...)'
/soap.asp, line 10

I am using Windows XP with IIS installed. There is an ASP page sending a
SOAP request to the following page. Here is the code receiving the error:

<%
Dim strQuery
Dim varSalesTotal
Set objReq = Server.CreateObject("Microsoft.XMLDOM")

'Load the request into XML DOM
objReq.Load Request
'Query the DOM for the input parameter
strQuery = "SOAP:Envelope/SOAP:Body/m:GetSalesTax/SalesTotal"
varSalesTotal = objReq.SelectSingleNode(strQuery).Text
'Calculate the sales tax
varSalesTax = varSalesTotal * 0.04

'Prepare the return envelope
strTmp = _
"" & _
"" & _
"" & _
"" & _
"" & varSalesTax & "" & _
"
" & _
"
" & _
"
"

'Write the return envelope
Response.Write strTmp
%>

I would have posted this in microsoft.public.xml.soap, but no one seems to
respond to the questions. I'm hoping that someone in this active group can
help.

Regards, Richard

Re: Object Required Error

am 28.02.2005 05:00:15 von westernnord

Just in case you need the SOAP request ASP page, here it is:

<%
Dim Reg
Dim xml
Dim RetVal
Reg = "" &
vbCrLf
Reg = Reg & "" & vbCrLf
Reg = Reg & "" & vbCrLf
Reg = Reg & "" &
vbCrLf
Reg = Reg & "100" & vbCrLf
Reg = Reg & "
" & vbCrLf
Reg = Reg & "
" & vbCrLf
Reg = Reg & "
"
Response.Write(Reg)
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.open "post", "http://localhost/soap.asp", False
xml.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xml.setRequestHeader "SOAPMethodName",
"urn:myserver/soap:TaxCalculator#GetSalesTax"
xml.send Reg
RetVal = xml.responseText
Response.Write(RetVal)
Response.End
Set xml = nothing
%>


wrote in message
news:eBLYyhUHFHA.3912@TK2MSFTNGP10.phx.gbl...
>I am getting the following error:
> Error Type:
> Microsoft VBScript runtime (0x800A01A8)
> Object required: 'objReq.SelectSingleNode(...)'
> /soap.asp, line 10
>
> I am using Windows XP with IIS installed. There is an ASP page sending a
> SOAP request to the following page. Here is the code receiving the error:
>
> <%
> Dim strQuery
> Dim varSalesTotal
> Set objReq = Server.CreateObject("Microsoft.XMLDOM")
>
> 'Load the request into XML DOM
> objReq.Load Request
> 'Query the DOM for the input parameter
> strQuery = "SOAP:Envelope/SOAP:Body/m:GetSalesTax/SalesTotal"
> varSalesTotal = objReq.SelectSingleNode(strQuery).Text
> 'Calculate the sales tax
> varSalesTax = varSalesTotal * 0.04
>
> 'Prepare the return envelope
> strTmp = _
> "" & _
> "" & _
> "" & _
> "" & _
> "" & varSalesTax & "" & _
> "
" & _
> "
" & _
> "
"
>
> 'Write the return envelope
> Response.Write strTmp
> %>
>
> I would have posted this in microsoft.public.xml.soap, but no one seems to
> respond to the questions. I'm hoping that someone in this active group can
> help.
>
> Regards, Richard
>

Re: Object Required Error

am 28.02.2005 12:49:31 von reb01501

westernnord@webtv.net wrote:
> I am getting the following error:
> Error Type:
> Microsoft VBScript runtime (0x800A01A8)
> Object required: 'objReq.SelectSingleNode(...)'
> /soap.asp, line 10
>
> I am using Windows XP with IIS installed. There is an ASP page
> sending a SOAP request to the following page. Here is the code
> receiving the error:
> <%
> Dim strQuery
> Dim varSalesTotal
> Set objReq = Server.CreateObject("Microsoft.XMLDOM")
>
> 'Load the request into XML DOM
> objReq.Load Request
> 'Query the DOM for the input parameter
> strQuery = "SOAP:Envelope/SOAP:Body/m:GetSalesTax/SalesTotal"
> varSalesTotal = objReq.SelectSingleNode(strQuery).Text

The problem is easily stated: selectSinglenode is not finding the node
specified by strQuery. To avoid this error you need to do this:

Dim oNode
Set oNode=Nothing
Set oNode=objReq.SelectSingleNode(strQuery)
if not oNode is Nothing Then
varSalesTotal = oNode.Text
else
'handle the error - save the xml to a file so you can look at it
end if

As to fixing strQuery, we cannot do that without seeing the xml in Request.


Remember: xpath is case sensitive. "SalesTotal" is not the same as
"salestotal"


Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: Object Required Error

am 01.03.2005 04:04:09 von westernnord

Outstanding Bob. There were a lot of case sensitive problems with the xml on
both pages.
I don't know what I would have done without your help.

Best regards, Richard

"Bob Barrows [MVP]" wrote in message
news:eSvfMuYHFHA.3216@tk2msftngp13.phx.gbl...
> westernnord@webtv.net wrote:
>> I am getting the following error:
>> Error Type:
>> Microsoft VBScript runtime (0x800A01A8)
>> Object required: 'objReq.SelectSingleNode(...)'
>> /soap.asp, line 10
>>
>> I am using Windows XP with IIS installed. There is an ASP page
>> sending a SOAP request to the following page. Here is the code
>> receiving the error:
>> <%
>> Dim strQuery
>> Dim varSalesTotal
>> Set objReq = Server.CreateObject("Microsoft.XMLDOM")
>>
>> 'Load the request into XML DOM
>> objReq.Load Request
>> 'Query the DOM for the input parameter
>> strQuery = "SOAP:Envelope/SOAP:Body/m:GetSalesTax/SalesTotal"
>> varSalesTotal = objReq.SelectSingleNode(strQuery).Text
>
> The problem is easily stated: selectSinglenode is not finding the node
> specified by strQuery. To avoid this error you need to do this:
>
> Dim oNode
> Set oNode=Nothing
> Set oNode=objReq.SelectSingleNode(strQuery)
> if not oNode is Nothing Then
> varSalesTotal = oNode.Text
> else
> 'handle the error - save the xml to a file so you can look at it
> end if
>
> As to fixing strQuery, we cannot do that without seeing the xml in
> Request.
>
>
> Remember: xpath is case sensitive. "SalesTotal" is not the same as
> "salestotal"
>

>
> Bob Barrows
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>