MSXML contains two classes that truly simply HTTP access, of not just XML data, but any kind of HTTP access. For
instance these classes may be used to post a SOAP request, access a Web page on some Web site that returns HTML or
binary data, call SQL Server 2000 XML templates or updategrams, etc.
Tip: Read Chapter 9: Sending and Retrieving XML Data from the book XML Application Development with MSXML 4.0.
Prior to version 3.0, MSXML only provided XMLHTTP class, that is designed and well-suited for client-side HTTP access.
For instance, MSXML XMLHTTP can be used from within a Web page on the client side (JScript code) to make HTTP
request and update parts of that Web page. XMLHTTP is based on famous WinInet library and hence is well-suited for
client side HTTP access.
Tip: Read XML and HTTP Data Access Classes article for a details discussion on differences in XMLHTTP and ServerXMLHTTP; and alternatives to these classes. (Paid subscription to ASPToday.com required to view the complete article).
With version 3.0, MSXML introduced ServerXMLHTTP, a class designed to do server-side HTTP access. ServerXMLHTTP is
based on WinHTTP, a new HTTP access component from Microsoft that is designed to be thread-safe, scalable, and UI-less.
ServerXMLHTTP is really a very powerful class and can really come very handy while doing server-to-server or cross-tier
HTTP data communication. Few examples where ServerXMLHTTP may be used include: calling a Web service, calling SQL Server
2000 XML template files or updategrams, calling a Web page that returns HTML/XML (if it returns HTML, you may do screen scrapping
by using regular expressions and get to the data values), and so on.
Tip: Chapter 9: (Sending and Retrieving XML Data) and Chapter 12: (Working with Data on the Client) in the book XML Application Development with MSXML 4.0 cover ServerXMLHTTP and XMLHTTP class in great details with lots of examples. perfectxml.com highly recommends this book for all MSXML developers.
Tip: Check out Frequently Asked Questions about ServerXMLHTTP.
PerfectXML Editor's Chioce :: ServerXMLHTTP KB Articles
Let's now look at a JavaScript example illustrating use of XMLHTTP and VBScript (ASP page) example illustrating using
ServerXMLHTTP:
JavaScript
<script language="JScript">
var objXMLHTTP = new ActiveXObject("Msxml2.XMLHTTP.3.0");
objXMLHTTP.open("GET", "http://www.perfectxml.com", false);
objXMLHTTP.send();
document.write(objXMLHTTP.responseText);
</script>
VBScript (ASP Page)
<%@ Language="VBScript" %>
<%
Dim objSvrHTTP
Dim PostData
Set objSvrHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
objSvrHTTP.open "GET", "http://search.atomz.com/search/?sp-a=sp10009b2d&sp-q=binary", false
objSvrHTTP.send
Response.Write objSvrHTTP.responseText
%>
MSXML XMLHTTP and ServerXMLHTTP Resources Around the Web
MSXML HTTP Access Related KB Articles
SQL XML and MSXML - an alternative approach to traditional data access
Using XML to Improve File-Upload Processing
WinHTTP Proxy Configuration Utility
Exploring the MSXML3 ServerXMLHTTP Object
|