ASP调用web services
生活随笔
收集整理的這篇文章主要介紹了
ASP调用web services
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
代碼
?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 ??? 這種方式需要構造一個SOAP請求的字符串。
??? 而在C#里面調用web services就簡單了許多。只要添加WEB引用,就可以像使用自己的類一樣使用了。
?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 ??? 這種方式需要構造一個SOAP請求的字符串。
??? 而在C#里面調用web services就簡單了許多。只要添加WEB引用,就可以像使用自己的類一樣使用了。
總結
以上是生活随笔為你收集整理的ASP调用web services的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: AVERAGE函数的功能是什么
- 下一篇: 2007年抓的兔子太多了,结果没抓到一个