Attempting to make an http post to a web service from a basicscript (VBScript/VBA scripting language - SummitSoftware) and want to implement a timeout.
Apparently the XmlHttpRequest object has a timeout property (http://msdn.microsoft.com/en-us/library/ms535874%28v=vs.85%29.aspx), but attempting to use it returns me a "property or method not found" error.
Eg:
Dim obj As Object
Set obj = CreateObject("MSXML2.XMLHTTP.3.0")
obj.timeout = 123
This also applies to Microsoft.XMLHTTP and开发者_如何学Python any other versions of the MSXML2 variant.
My only thought so far is to kick of another process which runs a vbscript to make the request. If it runs for more than a given time, kill the process. Not exactly ideal however.
Any ideas on this, or how this might be implemented differently?
Edit (possible solutions):
- WShell.Run a VBScript to run in another process and complete the operation async. Kill if runs for more than n.
- Use HTTP/1.1 Keep-Alive header. Would rather implement this on the client.
Are you using VBA/VB6 or VBScript? In VBScript, Dim obj As Object
is not valid as there is no static typing.
I think you might be looking at the wrong object reference. The MSXML2.XMLHTTP
object has the IXMLHTTPRequest
interface which is defined here and the reference you mention is for the XmlHttpRequest
object supported by Internet Explorer 7+.
I use this in vbscript: oXMLHTTP.setTimeouts 60000,60000,60000,60000 to place before the OPEN doc (mutatis mutandis for syntax): http://msdn.microsoft.com/en-us/library/ms760403%28v=vs.85%29.aspx hope it helps, surely to late :-) ...
精彩评论