I am trying to request xml data from a e-commerce API in ASP classic and "transform" the data into new XML and return that data as the response.
This is the ASP script.
<%
product_code = Request.QueryString("product_code")
url = "http://www.the site.com/net/WebService.aspx?Login=name@thehost.com&EncryptedPassword=***********&EDI_Name=Generic\Products&SELECT_Columns=p.ProductCode,p.ProductName,pd.ProductDescriptionShort,pe.ListPrice,pe.ProductPrice,pe.SalePrice&WHERE_Column=p.ProductCode&WHERE_Value=" & product_code
Set xData = CreateObject("Microsoft.XMLHTTP")
xData.Open "get", url, False
xData.Send
Response.ContentType = "text/xml"
Response.write (xData.responseText)
Set xData = Nothing
%>
Here is a sample of the returned data from the ASP script which calls the API. For instance ifthe above page is called getdata.asp and I call it with www.thesite.com/getdata.asp?product_code=m406789 then the following will be returned.
<?xml version="1.0" encoding="UTF-8"?>
<xmldata>
<Products>
<ProductCode>M406789</ProductCode>
<ProductID>858</ProductID>
<ProductName>M406789 Ignition Box</ProductName>
<ProductDescriptionShort><img alt="" src="/v/vspfiles/assets/images/alliance_small.jpg" align="right" />Ignition Box</ProductDescriptionShort>
<ListPrice>134.2200</ListPrice>
<ProductPrice>80.5300</ProductPrice>
<SalePrice>59.9500</SalePrice>
</Products>
</xmldata>
What I would like to do is have the returned XML data look like this.
<?xml version="1.0" encoding="UTF-8"?>
<hotspot>
<ProductCode>M406789</ProductCode>
<ProductID>858</ProductID>
<ProductName>M406789 Ignition Box</ProductName>
<ProductDescriptionShort><img alt="" src="/v/vspfiles/assets/images/alliance_small.jpg" align="right" />Ignition Box</ProductDescriptionShort>
<ListPrice>134.2200</ListPrice>
<ProductPrice>80.5300</ProductPrice>
<SalePrice>59.9500</SalePrice>
</hotspot>
Any help or sample code would be much appreciated. Not sure what route to take here.