Reputation: 1763
pXML= Product_Request
set http= server.Createobject("MSXML2.ServerXMLHTTP")
http.Open "GET", "http://test.com/Data_Check/Request.asp?XML_File=" & pXML , False
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
http.send
I need to send request with above asp code for the above URL. But i no need response from that server.
After sending the request, it waits for the response. How do I write this so that it doesn't block while waiting for the response?
Upvotes: 1
Views: 6395
Reputation: 189457
You may be able to use the WinHTTPRequest object directly instead (this is what underlies ServerXMLHTTP). It has an additional method which might be useful the WaitForResponse
method.
Set winHttpRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
winHttpRequest.Open "GET", "http://localhost/mypage.aspx", true
winHttpRequest.Send
''# Do other request normally here
winHttpRequest.WaitForResponse()
Note the Open
method has true
for its async
parameter. In this case Send
will return as soon as the request has been sent but before any response has been recieved. You can now do other things like make your other request in a normal synchronous manner. Once done you can make sure that the orginal request has completed by calling WaitForResponse
.
CAVEATs
Open
might complain that the script environment doesn't "do asynchronous calls".Upvotes: 1
Reputation: 25966
Change your Open request to Asynchronous (i.e. 3rd parameter to True). This will allow you to submit two requests at the same time. Then you get wait for both responses to arrive.
pXML = Product_Request
Set http = server.Createobject("MSXML2.ServerXMLHTTP")
http.Open "GET", "http://test.com/Data_Check/Request.asp?XML_File=" & pXML , True
http.Send
Set http2 = server.Createobject("MSXML2.ServerXMLHTTP")
http2.Open "GET", insert_code_for_your_second_url_here , True
http2.Send
http1.WaitForResponse
http2.WaitForResponse
Upvotes: 2
Reputation: 114377
I don't believe there is a way to determine that your request was successful without a response. So what's to determine the difference between no response and complete failure?
Upvotes: 0