Sending and Retrieving XML Data



techstore
LQ Net Home















Sending and Retrieving XML Data

Server to Server HTTP communications

page    Printer Friendly Page


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




   Today's News





Office Depot, Inc

Tech Depot - An Office Depot Co.



Overstock.com, Inc.

























Copyright © 2006-2008, LQ Systems,Inc. All rights reserved.