Server to Server HTTP communications
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