GetXML Function – Send and Retrieve XML in ASP or VBScript

XML data sources are more and more important today. From RSS feeds to SOAP to eCommerce based applications. The ability to send and retrieve XML from a web application can be critical. Thankfully ASP has the ability to read from an HTTP data stream via a COM object from Microsoft called “ServerXMLHTTP” which facilitates the whole process.

Here are a couple of functions to send XML and then read the XML response from the web server. If you just want to read the XML from the remote machine simply pass a blank string as the sSendXML portion of the function will retrieve the default information. If you want to use this function in VBScript just remove the “Server.” potion of the “Set oXMLHTTP = Server.CreateObject(“MSXML2.ServerXMLHTTP”)” line.

After retrieving the XML from the remote server you’ll have to use the Split() function or more likely the Microsoft XML DOM object to parse the response.

 

Leave a Comment