473,223 Members | 1,662 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,223 software developers and data experts.

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 9830
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
0
by: Pentti | last post by:
Can anyone help to understand why re-parsing occurs on a remote database (using database links), even though we are using a prepared statement on the local database: Scenario: ======== We...
5
by: gamehack | last post by:
Hi all, I was thinking about parsing equations but I can't think of any generic approach. Basically I have a struct called math_term which is something like: struct math_term { char sign; int...
5
by: randy | last post by:
Can some point me to a good example of parsing XML using C# 2.0? Thanks
3
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in...
3
by: Anup Daware | last post by:
Hi Group, I am facing a strange problem here: I am trying to read xml response from a servlet using XmlTextWriter. I am able to read the read half of the xml and suddenly an exception:...
6
by: jackwootton | last post by:
Hello everyone, I understand that XML can be parsed using JavaScript using the XML Document object. However, it is possible to parse XHTML using JavaScript? I currently listen for DOMMutation...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
6
by: gw7rib | last post by:
I have a program that needs to do a small amount of relatively simple parsing. The routines I've written work fine, but the code using them is a bit long-winded. I therefore had the idea of...
1
by: eyeore | last post by:
Hello everyone my String reverse code works but my professor wants me to use pop top push or Stack code and parsing code could you please teach me how to make this code work with pop top push or...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.