Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XMLHTTP, EVENTHANDLER(), and BINDEVENTS()
Message
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Title:
XMLHTTP, EVENTHANDLER(), and BINDEVENTS()
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01009527
Message ID:
01009527
Views:
61
Hi all,

I need some advice regarding the use of XMLHTTP and its interfaces. I need to send multiple HTTP requests to a server, and would like to do asynchronously. I'll also need to use the class's events to trigger tasks in the calling program. I've used VFP's class browser to generate the interface code (I THINK I have the right one!), but EVENTHANDLER() returns .F.

Here's my patrhetic code; any suggestions?

LOCAL oXMLHTTP as MSXML2.XMLHTTP30
oEvents=NEWOBJECT("XMLHTTPevents")
oXMLHTTP=NEWOBJECT("Microsoft.XMLHTTP")
bEventsHandled=EVENTHANDLER(oXMLHTTP,oEvents)

oXMLHTTP.open("POST","http://www.microsopht.com",.F.)
oXMLHTTP.send()
MESSAGEBOX(oXMLHTTP.responseText)

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

DEFINE CLASS XMLHTTPevents AS session OLEPUBLIC

IMPLEMENTS IXMLHTTPRequest IN "Microsoft.XMLHTTP"

PROCEDURE IXMLHTTPRequest_open(bstrMethod AS STRING, bstrUrl AS STRING, varAsync AS VARIANT, bstrUser AS VARIANT, bstrPassword AS VARIANT) AS VOID;
HELPSTRING "Open HTTP connection"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_setRequestHeader(bstrHeader AS STRING, bstrValue AS STRING) AS VOID;
HELPSTRING "Add HTTP request header"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_getResponseHeader(bstrHeader AS STRING) AS STRING;
HELPSTRING "Get HTTP response header"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_getAllResponseHeaders() AS STRING;
HELPSTRING "Get all HTTP response headers"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_send(varBody AS VARIANT) AS VOID;
HELPSTRING "Send HTTP request"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_abort() AS VOID;
HELPSTRING "Abort HTTP request"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_get_status() AS Number;
HELPSTRING "Get HTTP status code"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_get_statusText() AS STRING;
HELPSTRING "Get HTTP status text"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_get_responseXML() AS VARIANT;
HELPSTRING "Get response body"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_get_responseText() AS STRING;
HELPSTRING "Get response body"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_get_responseBody() AS VARIANT;
HELPSTRING "Get response body"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_get_responseStream() AS VARIANT;
HELPSTRING "Get response body"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_get_readyState() AS Number;
HELPSTRING "Get ready state"
* add user code here
ENDPROC

PROCEDURE IXMLHTTPRequest_put_onreadystatechange(eValue AS VARIANT @);
HELPSTRING "Register a complete event handler"
* add user code here
ENDPROC

ENDDEFINE
John MR Fitzgerald
Order Inc.
Next
Reply
Map
View

Click here to load this message in the networking platform