2

I have a VBS that makes a large number of GET requests using a ServerXMLHTTP object:

    SET xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
    xmlhttp.setTimeouts 5000, 5000, 10000, 120000 'ms - resolve, connect, send, receive

    ...

    ' Now do the following for lots of different GetURLs:
    xmlhttp.open "GET", GetURL, false
    xmlhttp.setRequestHeader "Content-type","text/xml"
    xmlhttp.setRequestHeader "Accept","text/csv"
    xmlhttp.send "{}"

    WScript.Echo "Readystate = " & xmlhttp.readyState & " at " & Now()
    IF xmlhttp.readyState <> 4 THEN
        xmlhttp.waitForResponse 1
    END IF
    WScript.Echo "Readystate = " & xmlhttp.readyState & " at " & Now()

I've found cases where the script never gets past xmlhttp.send unless I run it asynchronously (i.e., using xmlhttp.open "GET", GetURL, true).

My understanding is that it should time-out, per the setTimeouts, and move ahead even when run synchronously. So what could be going on? (Based on reading so far it sounds like "a lot," but documentation on this is murky at best...)

feetwet
  • 3,248
  • 7
  • 46
  • 84
  • your code run perfectly on my computer..are you sure `GetURL` value is a valid url? Can you open that url on browser? – Susilo Feb 25 '16 at 21:45
  • 1
    @Susilo - Yes, it runs perfectly well *most* of the time. I can `GET` a whole series of different URLs. But occasionally I'll run it and after some number of `GET`s it will hang on one. When I've checked in a browser I do get data, but even if it were invalid I would expect `.send` to return within the timeout and just have `.status` set to whatever the problem is. – feetwet Feb 25 '16 at 22:01

0 Answers0