Jump to content

How to receive and parse XML requests at my server using Classic ASP

websagogoer's Photo
Posted Nov 27 2012 11:17 AM
18362 Views

To any XML pros out there,,,

I am new to XML and need some guidance for anyone who can help! My problem is that I am unsure how to RECEIVE the xml request. I have the request and response built in basic form displayed below. The problem is HOW TO RECEIVE & PARSE. It may be as simple as a dozen lines of code, but I have not seen anywhere I've searched.

<code>
<%
' My Sample Request ******

WAGconnect = "http://www....."
set xmldom = server.CreateObject("Microsoft.XMLDOM")
set xmlhttp = server.CreateObject("Microsoft.XMLHTTP")

xmlhttp.open "POST", WAGconnect, false
xmlhttp.setRequestHeader "Man", POST & " " & WAGconnect & " HTTP/1.1"
xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xmlhttp.setRequestHeader "SOAPAction", "http://www.MyDomainConnection...."

StrSoap = StrSoap & "<?xml version=""1.0"" encoding=""utf-8""?>"
StrSoap = StrSoap & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
StrSoap = StrSoap & "<soap:Body>"
StrSoap = StrSoap & "<Get_Categories>"
StrSoap = StrSoap & "<Authentication>"
StrSoap = StrSoap & "<UserID>"&UserID&"</UserID>"
StrSoap = StrSoap & "<Password>"&Password&"</Password>"
StrSoap = StrSoap & "</Authentication>"
StrSoap = StrSoap & "<DealerInfo>"
StrSoap = StrSoap & "<DealerID>"&DealerID&"</DealerID>"
StrSoap = StrSoap & "<StoreID>"&StoreID&"</StoreID>"
StrSoap = StrSoap & "</DealerInfo>"
StrSoap = StrSoap & "<CatInfo>"
StrSoap = StrSoap & "<Dept>"&Dept&"</Dept>"
StrSoap = StrSoap & "</CatInfo>"
StrSoap = StrSoap & "</Get_Categories>"
StrSoap = StrSoap & "</soap:Body>"
StrSoap = StrSoap & "</soap:Envelope>"

WAGRequest = StrSoap

xmlhttp.send(WAGRequest)

%>

</code>


The problem is HERE. not knowing how to listen for and receive the above request at my server. Ive never done it before so I do not know what to look for.


<code>
<%

' My Sample Response ******


StrSoap = StrSoap & "<?xml version=""1.0"" encoding=""utf-8"" ?>"
StrSoap = StrSoap & "<soapenv:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"">"
StrSoap = StrSoap & "<soap:Body>"
StrSoap = StrSoap & "<Get_Categories xmlns=""urn:externalwsdl"">"
StrSoap = StrSoap & "<Result-Code>"&ResultCode&"</Result-Code>"
StrSoap = StrSoap & "<CatCount>"&CatCount&"</CatCount>"
StrSoap = StrSoap & "<Category>"
StrSoap = StrSoap & "<CatName>"&CatName&"</CatName>"
StrSoap = StrSoap & "<CatDesc>"&CatDesc&"</CatDesc>"
StrSoap = StrSoap & "<CatPic>"&CatPic&"</CatPic>"
StrSoap = StrSoap & "<CatMemo>"&CatMemo&"</CatMemo>"
StrSoap = StrSoap & "</Category>"
StrSoap = StrSoap & "</Get_Categories>"
StrSoap = StrSoap & "</soapenv:Body>"
StrSoap = StrSoap & "</soapenv:Envelope>"
responseTxt = StrSoap
%>
</code>


Any help you could offer would great.

Tags:
0 Subscribe


1 Reply

0
  baron122's Photo
Posted Mar 02 2014 08:52 AM

This great Article I am new to XML and need some guidance for anyone who can help! My problem is that I am unsure how to RECEIVE the xml request. I have the request and response built in basic form displayed below. The problem is HOW TO RECEIVE & PARSE. It may be as simple as a dozen lines of code, but I have not seen anywhere I've searched.

<code>
<%
' My Sample Request ******

WAGconnect = "http://www.truckrepairdirectory.com ....."
set xmldom = server.CreateObject("Microsoft.XMLDOM")
set xmlhttp = server.CreateObject("Microsoft.XMLHTTP")

xmlhttp.open "POST", WAGconnect, false
xmlhttp.setRequestHeader "Man", POST & " " & WAGconnect & " HTTP/1.1"
xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xmlhttp.setRequestHeader "SOAPAction", " http://www.mobiletuckrepair.info ...."

StrSoap = StrSoap & "<?xml version=""1.0"" encoding=""utf-8""?>"
StrSoap = StrSoap & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
StrSoap = StrSoap & "<soap:Body>"
StrSoap = StrSoap & "<Get_Categories>"
StrSoap = StrSoap & "<Authentication>"
StrSoap = StrSoap & "<UserID>"&UserID&"</UserID>"
StrSoap = StrSoap & "<Password>"&Password&"</Password>"
StrSoap = StrSoap & "</Authentication>"
StrSoap = StrSoap & "<DealerInfo>"
StrSoap = StrSoap & "<DealerID>"&DealerID&"</DealerID>"
StrSoap = StrSoap & "<StoreID>"&StoreID&"</StoreID>"
StrSoap = StrSoap & "</DealerInfo>"
StrSoap = StrSoap & "<CatInfo>"
StrSoap = StrSoap & "<Dept>"&Dept&"</Dept>"
StrSoap = StrSoap & "</CatInfo>"
StrSoap = StrSoap & "</Get_Categories>"
StrSoap = StrSoap & "</soap:Body>"
StrSoap = StrSoap & "</soap:Envelope>"

WAGRequest = StrSoap

xmlhttp.send(WAGRequest)

%>

</code>


The problem is HERE. not knowing how to listen for and receive the above request at my server. Ive never done it before so I do not know what to look for.


<code>
<%

' My Sample Response ******


StrSoap = StrSoap & "<?xml version=""1.0"" encoding=""utf-8"" ?>"
StrSoap = StrSoap & "<soapenv:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"">"
StrSoap = StrSoap & "<soap:Body>"
StrSoap = StrSoap & "<Get_Categories xmlns=""urn:externalwsdl"">"
StrSoap = StrSoap & "<Result-Code>"&ResultCode&"</Result-Code>"
StrSoap = StrSoap & "<CatCount>"&CatCount&"</CatCount>"
StrSoap = StrSoap & "<Category>"
StrSoap = StrSoap & "<CatName>"&CatName&"</CatName>"
StrSoap = StrSoap & "<CatDesc>"&CatDesc&"</CatDesc>"
StrSoap = StrSoap & "<CatPic>"&CatPic&"</CatPic>"
StrSoap = StrSoap & "<CatMemo>"&CatMemo&"</CatMemo>"
StrSoap = StrSoap & "</Category>"
StrSoap = StrSoap & "</Get_Categories>"
StrSoap = StrSoap & "</soapenv:Body>"
StrSoap = StrSoap & "</soapenv:Envelope>"
responseTxt = StrSoap
%>
</code>


Any help you could offer would great.