Forum Moderators: open

Message Too Old, No Replies

Testing XML Server Before Posting

XML Questing on Posting

         

thdrought

10:38 am on Dec 28, 2003 (gmt 0)

10+ Year Member



I run this code in order to get real-time shipping updates from USPS. While performing tests on the store I am building, I noticed that if USPS is not online, the XML POst command cannot connect, and it errors hard.

My question, is there a simple way to have XML, or ASP, test the connection to the USPS server first. If it is down, I just forward he customer on with a response that shipping costs will need to be manually calculated.

Heres my code:

Dim xmlhttp
Set xmlhttp = Server.CreateObject("MSxml2.Serverxmlhttp")
xmlhttp.Open "POST","http://test.shippingapis.com/shippingapitest.dll?",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send strxml

Thank you

mattglet

2:28 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



it's still early and i'm taking a stab:

Dim xmlhttp
Set xmlhttp = Server.CreateObject("MSxml2.Serverxmlhttp")

on error resume next
xmlhttp.Open "POST","http://test.shippingapis.com/shippingapitest.dll?",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send strxml

if err.number <> 0 then
response.write err.description
end if

on error goto 0

-Matt