Sending and Retrieving XML Data
Server to Server HTTP communications
by Linda Quinn
Close Window
Using the DOM to retrieve an XML document on a remote server
Set the ServerHTTPRequest property of the XMLDocument to TRUE.
<@ Language="VBScript" >
<
Option Explicit
Response.ContentType = "text/xml"
Dim oXMLDoc
Dim ProdID
Dim xPathExp
Dim oProdNode
Set oXMLDoc = Server.CreateObject("MSXML2.DOMDocument.4.0")
ProdID = Request.QueryString("varProdID")
oXMLDoc.SetProperty "ServerHTTPRequest", true
oXMLDoc.async = false
oXMLDoc.load "http://RemoteServer/inventory.xml"
xPathExp = "/Inventory/Product[@prodID=' " & ProductID & " '] "
Set oProdNode = oXMLDoc.selectSingleNode (xPathExp)
Response.write oPathNode.xml
%>
Using ServerXMLHTTP
This example uses the ServerXMLHTTP to send a GET request.
<@ Language="VBScript" >
<
Option Explicit
Response.ContentType = "text/xml"
Dim oSRV
Dim ProdID
Dim xPathExp
Dim oProdNode
Set oSRV = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0")
ProdID = Request.QueryString("varProdID")
oXMLDoc.open "GET", "http://RemoteServcer/Inventory.xml", false
oXMLDoc.send
xPathExp = "/Inventory/Product[@prodID=' " & ProductID & " '] "
Set oProdNode = oSRV.responseXML.selectSingleNode (xPathExp)
Response.write oProdNode.xml
%>
To call these ASP Scripts:
http://localhost/Manufacturing/Inventory/GetProd.asp?varProdID=PD1234
=================================================================
This content was created by Linda Quinn of LQNet.
See http://www.lqnet.com for a great
collection of articles on this and other topics.
=================================================================
Copyright © 2006-2008, LQ Systems,Inc. All rights reserved.
====================================================================
Want an expert to help with your project?
LQ Systems, Inc.
Business Solutions
====================================================================