Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

XML parsing using ASP
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.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Report this thread to moderator Post Follow-up to this message
Old Post
VK
09-30-04 08:55 PM


Re: XML parsing using ASP
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.



Report this thread to moderator Post Follow-up to this message
Old Post
Bob Barrows [MVP]
09-30-04 08:55 PM


Re: XML parsing using ASP
Show error message.
Show xml.responseText

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


<VK> wrote in message news:%23QzvQxupEHA.1952@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.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!



Report this thread to moderator Post Follow-up to this message
Old Post
Mark Schupp
09-30-04 08:55 PM


Re: XML parsing using ASP
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.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Report this thread to moderator Post Follow-up to this message
Old Post
VK
09-30-04 08:55 PM


Re: XML parsing using ASP
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.



Report this thread to moderator Post Follow-up to this message
Old Post
Bob Barrows [MVP]
10-01-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ASP archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:39 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.