下面是一个 SOAP 请求和响应示例。所显示的占位符需要由实际值替换。
POST /webserver/WS_BIG5/qq.asmx HTTP/1.1
Host: webserver.wzilin.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/Mobile "
<?xml version= "1.0 " encoding= "utf-8 "?>
<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/ ">
<soap:Body>
<Mobile xmlns= "http://tempuri.org/ ">
<Mobile> string </Mobile>
</Mobile>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version= "1.0 " encoding= "utf-8 "?>
<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/ ">
<soap:Body>
<MobileResponse xmlns= "http://tempuri.org/ ">
<MobileResult> string </MobileResult>
</MobileResponse>
</soap:Body>
</soap:Envelope>
-------------------------------
strxml = " <?xml version= '1.0 ' encoding= 'utf-8 '?> "
strxml = strxml & " <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/ '> "
strxml = strxml & " <soap:Body> "
strxml = strxml & " <Mobile xmlns= 'http://webserver.wzilin.com/webserver/WS_BIG5/qq.asmx '> "
strxml = strxml & " <Mobile> 13900000000 </Mobile> "
strxml = strxml & " </Mobile> "
strxml = strxml & " </soap:Body> "
strxml = strxml & " </soap:Envelope> "
Set h = Server.CreateObject( "Microsoft.XMLHTTP ")
h.open "POST ", "http://webserver.wzilin.com/webserver/WS_BIG5/qq.asmx ", False
h.setRequestHeader "Host ", "webserver.wzilin.com "
h.setRequestHeader "Content-Type ", "text/xml; charset=utf-8 "
h.setRequestHeader "Content-Length ",LEN(strxml)
h.setRequestHeader "SOAPAction ", "http://webserver.wzilin.com/webserver/WS_BIG5/qq.asmx/Mobile "
h.send (strxml)
If h.Status = 200 Then
Set objXML = server.CreateObject( "Microsoft.XMLDOM ")
objXML.load(h.responseXML)
xmlstr=objXML.childNodes(1).Text
Set objXML=nothing
response.write xmlstr
Else
Response.Write h.Status & ":其他 <br> "