Discussion:
How to cancel an MSXML2.XMLHTTP Request?
(too old to reply)
Michael Posthoff
2005-05-03 12:03:13 UTC
Permalink
Hello,

I load flightdetails as XML from various AirlineServers, that can take a
while, see the timeout from 120 secs in the code:

SET objHTTP = Server.CreateObject(Application("ServerXML"))
objHTTP.SetTimeouts 10000, 10000, 10000, 120000

objHTTP.open "POST", Application("XML_Requestor"), false
objHTTP.setRequestHeader "CONTENT-TYPE", "text/xml"
objHTTP.send XMessage


How can I cancel a request already sent, when, e.g. the client has already
canceled the connection, any ideas?

Regards,
Michael Posthoff
Martin Honnen
2005-05-03 13:22:15 UTC
Permalink
Post by Michael Posthoff
SET objHTTP = Server.CreateObject(Application("ServerXML"))
objHTTP.SetTimeouts 10000, 10000, 10000, 120000
objHTTP.open "POST", Application("XML_Requestor"), false
objHTTP.setRequestHeader "CONTENT-TYPE", "text/xml"
objHTTP.send XMessage
How can I cancel a request already sent, when, e.g. the client has already
canceled the connection, any ideas?
There is an abort method that can be called e.g.
objHTTP.abort
that cancels a request.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Michael Posthoff
2005-05-03 13:54:04 UTC
Permalink
Hallo,

yes I am about to invoke it, but it demands the use of asynchronous calls
and the use of

objHTTP.onreadystatechange=checkState(objHTTP.readyState)

Causes the error..

Laufzeitfehler in Microsoft VBScript-Fehler '800a000d'

Typen unverträglich: 'checkState(...).onreadystatechange'
Post by Martin Honnen
Post by Michael Posthoff
SET objHTTP = Server.CreateObject(Application("ServerXML"))
objHTTP.SetTimeouts 10000, 10000, 10000, 120000
objHTTP.open "POST", Application("XML_Requestor"), true
objHTTP.setRequestHeader "CONTENT-TYPE", "text/xml"
objHTTP.send XMessage
How can I cancel a request already sent, when, e.g. the client has already
canceled the connection, any ideas?
There is an abort method that can be called e.g.
objHTTP.abort
that cancels a request.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Martin Honnen
2005-05-03 14:27:51 UTC
Permalink
Post by Michael Posthoff
it demands the use of asynchronous calls
and the use of
objHTTP.onreadystatechange=checkState(objHTTP.readyState)
Causes the error..
Laufzeitfehler in Microsoft VBScript-Fehler '800a000d'
Typen unverträglich: 'checkState(...).onreadystatechange'
If checkState is the name of a function then I think with VBScript you
need to assign
objHTTP.onreadystatechange = GetRef("checkState")
to set an event handler.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Loading...