Howdy,
I do not know if this should be here or in the ASP forum. But I'm trying to get USPS's API to gather shipping rates. I can send the request and get the response ok - except I'm stuck on two things.
How do I look for the node name of error in place of package?
And second - if I do a write out of the response back, the first set shows correctly. This is what i'm using to just write it out - except there are suppose to be two lines instead of just the first.
That code will spit out one line like this
instead of both lines as shown in the XML itself below.
This is how usps returns the data in it's entirity - all I need is the mailservice and rate that are inside the Postage Nodes. I never request more than one Package ID at a time.
I am very weak on XML, trying mostly to modify code I got to work for UPS to show USPS okay. Thank you for your help in advance.
Stuart
A+, Net+, Security+, MCP
I do not know if this should be here or in the ASP forum. But I'm trying to get USPS's API to gather shipping rates. I can send the request and get the response ok - except I'm stuck on two things.
How do I look for the node name of error in place of package?
And second - if I do a write out of the response back, the first set shows correctly. This is what i'm using to just write it out - except there are suppose to be two lines instead of just the first.
Code:
Set mydoc=Server.CreateObject("Microsoft.xmlDOM")
mydoc.loadxml(responsexml)
Set NodeList = mydoc.documentElement.selectNodes("Package")
For strCount = 0 To NodeList.length - 1
response.write NodeList.Item(strCount).selectSingleNode("Postage/MailService").Text & " - $ " & NodeList.Item(strCount).selectSingleNode("Postage/Rate").Text & "<BR>"
NEXT
That code will spit out one line like this
Code:
Priority Mail Flat Rate Box (11.25" x 8.75" x 6") - $ 7.70
instead of both lines as shown in the XML itself below.
This is how usps returns the data in it's entirity - all I need is the mailservice and rate that are inside the Postage Nodes. I never request more than one Package ID at a time.
Code:
<?xml version="1.0" ?>
- <RateV2Response>
- <Package ID="0">
<ZipOrigination>10022</ZipOrigination>
<ZipDestination>20008</ZipDestination>
<Pounds>10</Pounds>
<Ounces>5</Ounces>
<Container>Flat Rate Box</Container>
<Size>REGULAR</Size>
<Zone>3</Zone>
- <Postage>
<MailService>Priority Mail Flat Rate Box (11.25" x 8.75" x 6")</MailService>
<Rate>7.70</Rate>
</Postage>
- <Postage>
<MailService>Priority Mail Flat Rate Box (14" x 12" x 3.5")</MailService>
<Rate>7.70</Rate>
</Postage>
</Package>
</RateV2Response>
I am very weak on XML, trying mostly to modify code I got to work for UPS to show USPS okay. Thank you for your help in advance.
Stuart
A+, Net+, Security+, MCP