469,332 Members | 6,874 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,332 developers. It's quick & easy.

XML parsing using ASP

VK
Dear All:

I have an issue trying to parse response from xml document, for that
matter I don't receive back response.

I am trying to integrate UPS e-commerce online tool into our web site,
this tool calcuates the rates and services and returns back all the
different shipping rates.

Below is the code trying to display the return response.

==============
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "POST", "https://wwwcie.ups.com/ups.app/xml/rate", False
xml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xml.Send xmltext
Response.Write xml.responseText
Dim xmldom
Set xmldom = Server.CreateObject("Microsoft.XMLDOM")
xmldom.async = false
xmldom.loadxml(xml.responseText)

(xmltext - has the XML string to send )

When I try to set
Set root = xmldom.documentElement

and try to display the child nodes - it comes back with error message.

Any help would be appreciated.

Many thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
4 9618
VK wrote:
Dear All:

I have an issue trying to parse response from xml document, for that
matter I don't receive back response.

I am trying to integrate UPS e-commerce online tool into our web site,
this tool calcuates the rates and services and returns back all the
different shipping rates.

Below is the code trying to display the return response.

==============
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
You should use "Microsoft.ServerXMLHTTP" in server-side code.I would also
suggest using "msxm2" instead of "Microsoft" to avoid version problems.
xml.Open "POST", "https://wwwcie.ups.com/ups.app/xml/rate", False
xml.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded" xml.Send xmltext
Response.Write xml.responseText
Dim xmldom
Set xmldom = Server.CreateObject("Microsoft.XMLDOM")
xmldom.async = false
xmldom.loadxml(xml.responseText)

(xmltext - has the XML string to send )

When I try to set
Set root = xmldom.documentElement

and try to display the child nodes - it comes back with error message.


????
Are we supposed to look up your error message in our crystal ball?

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #2
Show error message.
Show xml.responseText

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
<VK> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
Dear All:

I have an issue trying to parse response from xml document, for that
matter I don't receive back response.

I am trying to integrate UPS e-commerce online tool into our web site,
this tool calcuates the rates and services and returns back all the
different shipping rates.

Below is the code trying to display the return response.

==============
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "POST", "https://wwwcie.ups.com/ups.app/xml/rate", False
xml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xml.Send xmltext
Response.Write xml.responseText
Dim xmldom
Set xmldom = Server.CreateObject("Microsoft.XMLDOM")
xmldom.async = false
xmldom.loadxml(xml.responseText)

(xmltext - has the XML string to send )

When I try to set
Set root = xmldom.documentElement

and try to display the child nodes - it comes back with error message.

Any help would be appreciated.

Many thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #3
VK
Here is the code:
set node = xmldom.documentElement
For Each child In node.childNodes
response.write child.Nodename & ": (" & child.Text & ")" & "<BR>"
next

Error message:
Microsoft VBScript runtime error '800a01a8'

Object required
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #4
VK wrote:
Here is the code:
set node = xmldom.documentElement
For Each child In node.childNodes
response.write child.Nodename & ": (" & child.Text & ")" & "<BR>"
next

Error message:
Microsoft VBScript runtime error '800a01a8'

Object required

Instead of

xmldom.loadxml(xml.responseText)

do this:

bStatus = xmldom.loadxml(xml.responseText)
if not bStatus then
Set xPE = xmldom.parseError
strMessage = "errorCode = " & xPE.errorCode & "<BR>"
strMessage = strMessage & "reason = " & xPE.reason & "<BR>"
strMessage = strMessage & "Line = " & xPE.Line & "<BR>"
strMessage = strMessage & "linepos = " & xPE.linepos & "<BR>"
strMessage = strMessage & "filepos = " & xPE.filepos & "<BR>"
strMessage = strMessage & "srcText = " & xPE.srcText & "<BR>"
Response.Write strMessage
Response.End
end if

Alternatively, there IS a ResponseXML property which can be used:

Set xmldom=xml.responseXML

Note: If the response was generated by an Active Server Pages (ASP) page and
the Multipurpose Internet Mail Extension (MIME) type was not correctly set
to "text/xml" using the ASP method Response.ContentType, responseXML will be
empty.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Gerrit Holl | last post: by
5 posts views Thread by gamehack | last post: by
5 posts views Thread by randy | last post: by
6 posts views Thread by jackwootton | last post: by
13 posts views Thread by Chris Carlen | last post: by
6 posts views Thread by gw7rib | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.