![](/Images/OutliningIndicators/ContractedBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
1 Function CallWebServices(sUrl, sMethodName, soapMessage, XmlString)
2 CallWebServices = false
3
4 Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
5 xmlhttp.Open "POST",sUrl, False
6 xmlhttp.SetRequestHeader "Content-Type","text/xml; charset=utf-8"
7 xmlhttp.SetRequestHeader "SOAPAction",sUrl & "/" & sMethodName
8 xmlhttp.send(soapMessage)
9 'response.Write("xmlhttp.Status : " & xmlhttp.Status & "<br>")
10 'response.Write("xmlhttp.statusText : " & xmlhttp.statusText & "<br>")
11 'response.Write("xmlhttp.responseText : " & xmlhttp.responseText & "<br>")
12 'response.Write("xmlhttp.responseXML.xml : " & xmlhttp.responseXML.xml & "<br>")
13 if xmlhttp.Status = 200 then
14 CallWebServices = true
15 XmlString = xmlhttp.responseXML.xml
16 end if
17 Set xmlhttp = Nothing
18 End Function
而在C#里面调用web services就简单了许多。只要添加WEB引用,就可以像使用自己的类一样使用了。