Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Issue with xmlhttp
Message
From
24/11/2008 17:05:59
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Issue with xmlhttp
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01363859
Message ID:
01363859
Views:
73
Have been using xmlhttp to get shipping rates from UPS. Now want to detect case where client is not connected to internet so can handle gracefully. If disconnect from Internet and run program, get error 0 at lcxml =oxmlhttp.responsetext statement below. Tried to intercept with on error, but success seems to depend on whether am in debugger or not.

How can I best detect user is not connected to internet using the xmlhttp object? Thanks.
oXMLHttp = CREATEOBJECT("Microsoft.xmlhttp")
oXMLHttp.open("POST", "https://wwwcie.ups.com/ups.app/xml/Rate", .T.)
oXMLHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
xx=alltrim(holdxml.holdxml)  && this is a memo field in the holdxml table which holds the request string
oXMLHttp.send(xx)
lcxml=oxmlhttp.responsetext
**11-24-08 intercept error with on error()
IF problem  && connecting to internet
	**handle the problem
else
	= XMLTOCURSOR(lcxml,"")  && transfer xml return to xmlresult cursor
	*etc.
endif
Next
Reply
Map
View

Click here to load this message in the networking platform