Discussion:
Newbie Difference between "Microsoft.XMLHTTP" and "Msxml2.ServerXMLHTTP.3.0" objects
(too old to reply)
fher182
2006-05-18 21:17:28 UTC
Permalink
I've been using both objects ("Microsoft.XMLHTTP" and
"Msxml2.ServerXMLHTTP.3.0") to retrieve data from the web. I
haven't used VBScript for a long time, but I always like to fully
understand what I learn. Any help will be appreciated, I been using
both of them in the same way with no problem at all.

Thanks
Anthony Jones
2006-05-19 07:58:23 UTC
Permalink
Post by fher182
I've been using both objects ("Microsoft.XMLHTTP" and
"Msxml2.ServerXMLHTTP.3.0") to retrieve data from the web. I
haven't used VBScript for a long time, but I always like to fully
understand what I learn. Any help will be appreciated, I been using
both of them in the same way with no problem at all.
Thanks
XMLHTTP uses the Wininet API which IE uses. Hence it is affected by choices
you make in the internet options dialog. It can also benefit from the local
cache which Wininet manages.

ServerXMLHTTP uses the WinHTTP API which does not honor settings in the
internet options. Not using wininet it can not supply a response from the
local cache. It is lighter than XMLHTTP. The key difference is that
WinHTTP is threadsafe whereas Wininet isn't.

What does this mean?

For script that runs in the Scripting host in a interactive or batch logon
XMLHTTP should be used. Scripts designed to run on client PCs should use
XMLHTTP. The WinHTTP component isn't guarenteed to be present (it won't be
present on Win98 or on "unservice packed" Win2000 boxes).

For script that runs in a COM+ or other mutlithreaded process (ASP pages for
example) should use ServerXMLHTTP. Using XMLHTTP in these environments is
dangerous and can lead to unexpected behaviour due to Wininet not being
threadsafe.

Note passing a HTTP URL to the Load method of a DOMDocument will be default
use Wininet to fetch document. Hence in a multithreaded environment
'.setProperty "ServerHTTPRequest", True' should be called which causes the
DOM to use WinHTTP when fetching a document.


Getting ServerXMLHTTP to use Proxy servers and access sites via SSL is a
little more involved since configuring these can not be done via the
internet options dialog.

HTH

Anthony.

Loading...