>I need to write a function that gets real UPS rates into my order entry system written in VFP. I'm just getting started and I'm wondering is the best approach to use UPS Online Tools or some type of OLE automation with WorldShip. All of the CS reps have Worldship installed and internet access. Just not sure which is the best approach. I want to feed it weight, service, zip and get get the rate.
>
>Has anybody done this? Got any examples? Thanks!
UPS should have an
XML request response web service. If so, use the HTTP Object:
oHTTP=CREATEOBJECT("MSXML2.ServerXMLHTTP.4.0")
And the form a UPS prescribed url to service your request:
oHTTP.Open("GET",lcURL,.f.)
oHTTP.Send("")
oHTTP.waitForResponse
lcReturn=oHTTP.responseText
oHTTP.abort
The XML string is in lcReturn. Some services have "garbage" and white spaces in their return strings, so you might need to clean them:
PROCEDURE cleanXML(strCSS)
strCSS=STRTRAN(strCSS,CHR(13),[])
strCSS=STRTRAN(strCSS,CHR(10),[])
strCSS=STRTRAN(strCSS,CHR(9),[])
strCSS=STRTRAN(strCSS,[ ],[])
RETURN strCSS
ENDPROC
Imagination is more important than knowledge