|MSXML provides a class named XMLHTTP that is well suited for HTTP data access from the client side (for server side use ServerXMLHTTP).
XMLHTTP is based on WinInet and is available on all the Microsoft platforms. Here is a small example of posting
XML data from Visual Basic client code to the ASP page:
The above server-side ASP code first creates the MSXML DOMDocument instance and loads the XML from the
Request stream. If successful, sends the received XML back to the client (this is just an example), if it fails to
load the document, sends the error description to the client.
Set objDOM = Server.CreateObject("Msxml2.DOMDocument.4.0")
objDOM.async = false
If objDOM.load (Request) Then
Response.ContentType = "text/xml"
Response.ContentType = "text/html"
Response.Write "Error: " & Err.Description & objDOM.parseError.reason
Here is the Visual Basic client code that uses XMLHTTP to post XML to the above ASP page (remember to add reference to
The above Visual Basic 6.0 code lines first create the XMLHTTP40 instance and then call its Open method
requesting a synchronous POST operation on the XMLPost.asp page. Next, it calls the XMLHTTP send method passing
the XML string. This method actually send the HTTP request and waits for it to return. We can use the XMLHTTP Status and
StatusText property to check for any HTTP errors and then use various response?????? properties (such as responseXML, responseText, etc.) to
get the results returned.
Dim objXMLHTTP As New MSXML2.XMLHTTP40
objXMLHTTP.Open "POST", "http://localhost/TestASP2/XMLPost.asp", False
Other Related Readings:
HOWTO: Submit Form Data by Using XMLHTTP or ServerXMLHTTP Object (Q290591)
HOWTO: Send a Binary Stream by Using XMLHTTP (Q296772)
HOWTO: Enable Compression and Decompression of Data By Using XMLHTTP Code (Q304279)
HOWTO: Use XSL to Transform Excel XML Spreadsheet for Server-Side Use (Q278976)