Nusoap,服务器端(php)和客户端ASP经典

时间:2009-10-26 20:56:10

标签: php web-services asp-classic nusoap

  

我正在尝试拨打网络服务   (使用 nusoap ),效果很好   我用 php客户端来称呼它。   它返回一个邮件地址列表。

(网上有很多关于php / php或php / asp.net等的例子......)

  

但是,我现在想要能够打电话给这个网站   使用经典ASP服务

到目前为止我什么都没找到, 有没有人成功实现了这样的Web服务组合:php(服务器)/ asp经典(客户端)? 或者知道怎么做? 如果答案是肯定的, 我很想听听你是怎么做到的! 非常感谢你。

2 个答案:

答案 0 :(得分:1)

我找到了解决问题的方法。这段代码对我有用

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

答案 1 :(得分:0)

你可以下载Microsoft SOAP Tookit 3.0,但我不推荐它,因为根据我的经验,这是一种痛苦。

还有this article in CodeProject,但我从不使用它,因此无法推荐。