ServerXMLHTTP Timeout in less than 2 seconds using default timeouts

1

I have a question involving a "timeout" when sending an HTTPS "GET" request using the ServerXMLHTTP object.

In order to fool the object to send the request with the logged in user's id and password, I set it up to use a dummy proxy and then excluded the domain of the URL (on the intranet). So variable url_to_get contains .mydomain.com, while the proxy address is actually "not.used.com".

// JScript source code
HTTP_RequestObject = new ActiveXObject("Msxml2.ServerXMLHTTP.6.0");

// Using logged in username authentication
HTTP_RequestObject.open("GET", url_to_get, false);
HTTP_RequestObject.setProxy(2, "not.used.com", "*.mydomain.com");

try
{
   HTTP_RequestObject.send();
}
catch (e)
{
}

In the catch block, I log an exception of "(0x80072EE2) The operation timed out". This is timestamped 1 to 2 seconds after a log message right before the open.

A retry will work as expected, and it can do it over and over again. Is this something on the server side? Or is it a result of the proxy?

proxy
xmlhttprequest
credentials
winhttprequest
asked on Stack Overflow Jan 16, 2014 by Miller14STL • edited Jan 19, 2014 by Miller14STL

2 Answers

0

Well this was painful and embarassing. I figured out the root cause of the issue I was seeing with the timeout. I had set the timeouts to "defaults" that were 3 orders of magnitude smaller than the real defaults. So even when I increased them to what I thought were really large values, I was still shorter than the defaults.

I had skimmed through the wording on the Microsoft page describing the setTimouts() method and misinterpreted the timebase of the parameters. I assumed seconds while it was actually milliseconds.

During the process of debugging this issue, I duplicated the code using the alternative COM object, "WinHttp.WinHttpRequest.5.1", and in verifying the equivalent API, SetTimeouts(), discovered the faux pas.

I did learn a few things in the process, so all is not lost, "WinHttp.WinHttpRequest.5.1" has a SetAutoLogonPolicy() [3] method that allows me to skip the hokey "proxy" foolishness required with "Msxml2.ServerXMLHTTP.6.0" to force it to send the user's credentials to an intranet server. I also fiddled with Fiddler [4] and learned enough to be dangerous!

Hopefully someone else can learn from my mistake and find this useful in debugging their own issue in the future.

Here are some inline links since I don't have enough rep to post more than two:

[3] : msdn.microsoft.com/en-us/library/windows/desktop/aa384050%28v=vs.85%29.aspx

[4] : fiddler2.com

answered on Stack Overflow Jan 19, 2014 by Miller14STL
0

Msxml2.ServerXMLHTTP.6.0 can be used via a proxy. It took me a while but persistence paid off. I moved from WinHttp.WinHttpRequest.5.1 to Msxml2.ServerXMLHTTP.6.0 at the advice of Microsoft.

Where varHTTP is your object reference to Msxml2.ServerXMLHTTP.6.0 you can use

varHTTP.setproxy 2, ProxyServerName, "BypassList"

Hope this helps and you pursue onwards with Msxml2.ServerXMLHTTP.6.0.

answered on Stack Overflow Jan 28, 2016 by Rob Lawton • edited Jan 28, 2016 by Alex Karshin

User contributions licensed under CC BY-SA 3.0