This code resides in an ASP – Soap.asp, in the root directory of the web server.
<%
Set objReq = Server.CreateObject("Microsoft.XMLDOM")
'Load the request into XML DOM
objReq.Load Request
'Query the DOM for the input parameter
strQuery = "SOAP:Envelope/SOAP:Body/m:GetSalesTax/SalesTotal"
varSalesTotal = objReq.SelectSingleNode(strQuery).Text
'Calculate the sales tax
varSalesTax = varSalesTotal * 0.04
'Prepare the return envelope
strTmp = _
"<soap:envelope xmlns:soap=""urn:schemas-xmlsoap-org:soap.v1"">" &
_
"<soap:header></soap:header>" & _
"<soap:body>" & _
"<m:getsalestaxresponse xmlns:m=""urn:myserver/soap:TaxCalc"">" &
_
"<salestax>" & varSalesTax & "</salestax>" &
_
"</m:getsalestaxresponse>" & _
"</soap:body>" & _
"</soap:envelope>"
'Write the return envelope
Response.Write strTmp
%>
Comments