站长网 Asp教程 ASP调用web services的教程

ASP调用web services的教程

ASP调用web services的教程

ASP调用web services

<%
Function CallWebServices(sUrl, sMethodName, soapMessage, XmlString)
CallWebServices = false

Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
xmlhttp.Open "POST",sUrl, False
xmlhttp.SetRequestHeader "Content-Type","text/xml; charset=utf-8"
xmlhttp.SetRequestHeader "SOAPAction",sUrl & "/" & sMethodName
xmlhttp.send(soapMessage)
'response.Write("xmlhttp.Status : " & xmlhttp.Status & "<br>")
'response.Write("xmlhttp.statusText : " & xmlhttp.statusText & "<br>")
'response.Write("xmlhttp.responseText : " & xmlhttp.responseText & "<br>")
'response.Write("xmlhttp.responseXML.xml : " & xmlhttp.responseXML.xml & "<br>")
if xmlhttp.Status = 200 then
CallWebServices = true
XmlString = xmlhttp.responseXML.xml
end if
Set xmlhttp = Nothing
End Function

%>

这种方式需要构造一个SOAP请求的字符串。

而在C#里面调用web services就简单了许多。只要添加WEB引用,就可以像使用自己的类一样使用了。

本文来自网络,不代表站长网立场,转载请注明出处:https://www.tzzz.com.cn/html/jc/asp/2024/0606/45992.html

作者: dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。
联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部