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 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 Objectis not valid as there is no static typing.I think you might be looking at the wrong object reference. The
MSXML2.XMLHTTPobject has theIXMLHTTPRequestinterface which is defined here and the reference you mention is for theXmlHttpRequestobject supported by Internet Explorer 7+.