我使用nusoap库用PHP创建一个web服务(如:http://www.sanity-free.org/125/php_webservices_and_csharp_dotnet_soap_clients.html)。
客户是C#。
使用http,一切正常。
With https, I have an error in visual studio when trying to add the service :
"There was an error dowloading https://service?wsdl". The request was aborted : could not create SSL/TLS secure channel.
这是否与http上的架构相关联?
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://services/soap/SimpleService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://services/soap/SimpleService">
targetNamespace中没有https ...我不知道如何在代码中解决这个问题。
感谢您的帮助!
答案 0 :(得分:0)
我有同样的问题,因为它在http上工作正常,但不在https上。只是在这里分享我的整个编程路径,以帮助他人。
我最初遵循本教程:php webservice with nusoap and c#。他在教程中没有说的只是你应该将所有的PHP代码放在一个php文件中(但是好吧,它可能只是简单明了,所以没有真正的投诉)。
我首先尝试使用http,我很高兴它有效,但后来我不得不转移到ssl,因为我在本地服务器上测试它,我有一个自签名证书,我收到错误:“底层连接已关闭:无法为SSL / TLS安全通道建立信任关系。“
我用Google搜索,最后在此链接中找到了解决方案:damir dobric blog
基本上你应该添加一行:
ServicePointManager.ServerCertificateValidationCallback +=
new System.Net.Security.RemoteCertificateValidationCallback(
customXertificateValidation);
并添加函数customXertificateValidation的实现以返回true(这是我为测试目的所做的)。