perfectxml.com
 Basic Search  Advanced Search   
Topics Resources Free Library Software XML News About Us
  You are here: home »» Focus »» MSXML » HTTP Access Saturday, 23 February 2008
 
NEWS
MSXML 4.0 SP2 now available!

 
MSXML
Basics
DOM
SAX
XPath
XSLT
Schemas
SOM
HTTP Access
.NET
Data Islands
Ask a Question
   Past Q&As
C++ Samples
DLL/Version Info
Reference Guide
Books
KB Articles
   HOW TO
   SAMPLE
   INFO
   BUG/PRB
   FIX
   Misc.
MSXML Tips
   August 2002
   September 2002
MSXML Tools

Microsoft XML Core Services

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.

  • MSXML 3.0 IXMLHTTPRequest/XMLHTTP Reference

  • MSXML 3.0 IServerXMLHTTPRequest/ServerXMLHTTP Reference

  • MSXML 4.0 IXMLHTTPRequest/XMLHTTP Reference

  • MSXML 4.0 IServerXMLHTTPRequest/ServerXMLHTTP Reference

       Tip: Check out Frequently Asked Questions about ServerXMLHTTP.

PerfectXML Editor's Chioce :: ServerXMLHTTP KB Articles

  • HOW TO: Trace ServerXMLHTTP Calls Using the Winhttptracecfg Tracing Tool
  • HOWTO: Capture TCP and HTTP Data Frames Using Network Monitor and MSXML HTTP Code
  • HOWTO: Submit Form Data by Using XMLHTTP or ServerXMLHTTP Object
  • INFO: Proxy Configuration Utility Must Be Run for ServerXMLHTTP to Work
  • PRB: Users Are Prompted for Credentials When Using XMLHTTP or ServerXMLHTTP to Access Remote Pages
  • PRB: "Access Denied" Error Message When Using ServerXMLHTTP to Access an Authenticated Site
  • BUG: "Access is denied" Error Message When Making HTTPS Requests with ServerXMLHTTP
  • INFO: XMLHTTPRequest Object Requires Internet Explorer 5.0 or Later
  • PRB: Load Method Fails When Loading XML File Over HTTP
  • HOWTO: Identify HTTP Errors When You Use the ServerXMLHTTP Object
  • HOWTO: Read and Display Binary Data in ASP Using ServerXMLHTTP
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", "https://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

  Contact Us |  | Site Guide | About PerfectXML | Advertise ©2004 perfectxml.com. All rights reserved. | Privacy