我正在尝试调用Web 服务 (使用nusoap ),当我使用php client调用它时效果很好。它返回一个邮件地址列表。
(网上有很多关于 php/php 或 php/asp.net 等的例子……)
但是,我现在希望能够使用经典 ASP 调用此 Web 服务
到目前为止我什么都没发现,有没有人成功实现过这样的web服务组合:php(server)/asp classic(client)?或者知道怎么做?如果答案是肯定的,我很想听听你是怎么做到的!非常感谢你。
我正在尝试调用Web 服务 (使用nusoap ),当我使用php client调用它时效果很好。它返回一个邮件地址列表。
(网上有很多关于 php/php 或 php/asp.net 等的例子……)
但是,我现在希望能够使用经典 ASP 调用此 Web 服务
到目前为止我什么都没发现,有没有人成功实现过这样的web服务组合:php(server)/asp classic(client)?或者知道怎么做?如果答案是肯定的,我很想听听你是怎么做到的!非常感谢你。
我找到了解决我的问题的方法。这段代码对我有用
url = "http://dev_api/service.php"
SOAPParameters = ""
SOAPParameters = " <param1>text1</param1>"
SOAPParameters = SOAPParameters & " <param2>text2</param2>"
SOAPParameters = SOAPParameters & " <param3>text3</param3>"
SOAPRequest = "<?xml version='1.0' encoding='utf-8'?>"
SOAPRequest = SOAPRequest & "<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/"">"
SOAPRequest = SOAPRequest & " <soap:Body>"
SOAPRequest = SOAPRequest & " <search>"
SOAPRequest = SOAPRequest & SOAPParameters
SOAPRequest = SOAPRequest & " </search>"
SOAPRequest = SOAPRequest & " </soap:Body>"
SOAPRequest = SOAPRequest & " </soap:Envelope>"
Set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
xmlhttp.open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8"
xmlhttp.setRequestHeader "Content-Length", LEN(SOAPRequest)
xmlhttp.setRequestHeader "SOAPAction", "http://dev_api/service.php"
xmlhttp.Send (SOAPRequest)
Response.Write xmlhttp.responseXML.xml
您可以下载Microsoft SOAP Tookit 3.0,但我不推荐它,因为根据我的经验,这很痛苦。
CodeProject 里面也有这篇文章,不过我没用过,不推荐。