This is a (quasi minimally) corrected version made to the original article.
[1] Client-side with reference to microsoft xml v3.0 type library (do not go higher).
[tt]
'client side
Sub Main
[red]'[/red]
Dim objHTTP As New MSXML.XMLHTTPRequest
[blue]Dim objHTTP As New MSXML2.XMLHTTP[/blue]
Dim strEnvelope As String
Dim strReturn As String
[red]'[/red]
Dim objReturn As New MSXML.DOMDocument
[blue]Dim objReturn As New MSXML2.DOMDocument[/blue]
Dim dblTax As Double
Dim strQuery As String
'Create the SOAP Envelope
strEnvelope = _
"<soap:envelope xmlns:soap=""urn:schemas-xmlsoap-org:soap.v1"">" & _
"<soap:header></soap:header>" & _
"<soap:body>" & _
"<m:getsalestax xmlns:m=""urn:myserver/soap:TaxCalculator"">" & _
"<salestotal>100</salestotal>" & _
"</m:getsalestax>" & _
"</soap:body>" & _
"</soap:envelope>"
'Set up to post to our local server
[green]objHTTP.open "post", "
False[/green]
'Set a standard SOAP/ XML header for the content-type
objHTTP.setRequestHeader "Content-Type", "text/xml"
'Set a header for the method to be called
objHTTP.setRequestHeader "SOAPMethodName", _
"urn:myserver/soap:TaxCalculator#GetSalesTax"
'Make the SOAP call
objHTTP.send strEnvelope
'Get the return envelope
strReturn = objHTTP.responseText
'Load the return envelope into a DOM
objReturn.loadXML strReturn
'Query the return envelope
[red]'[/red]
strQuery = _
[red]'[/red]
"SOAP:Envelope/SOAP:Body/m:GetSalesTaxResponse/SalesTax"
[blue]strQuery = _
"soap:envelope/soap:body/m:getsalestaxresponse/salestax"[/blue]
dblTax = objReturn.selectSingleNode(strQuery).Text
Debug.Print dblTax
End Sub
[/tt]
[2] Server-side soap.asp
[tt]
Set objReq = Server.CreateObject("Microsoft.XMLDOM")
'Load the request into XML DOM
objReq.Load Request
'Query the DOM for the input parameter
[red]'[/red]
strQuery = "SOAP:Envelope/SOAP:Body/m:GetSalesTax/SalesTotal"
[blue]strQuery = "soap:envelope/soap:body/m:getsalestax/salestotal"[/blue]
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[green]ulator[/green]"">" & _
"<salestax>" & varSalesTax & "</salestax>" & _
"</m:getsalestaxresponse>" & _
"</soap:body>" & _
"</soap:envelope>"
'Write the return envelope
Response.Write strTmp
[/tt]