Nusoap with https

混江龙づ霸主 提交于 2019-12-08 02:55:47

问题


I am unsure if there is any difference for PHP-Nusoap client in sending web services request to http and https. For the user testing, the client was using http://xxx.xxx.xxx.xxx:3833/ws/ws.svc?wsdl which was working fine. However when the client moved to the production server with https (replace the http in previous link with https) I don't get any reply.

Thanks in advance


回答1:


I had the same problem, as it was working fine on http, but wasn't on https. Just to share my whole programming path here, to help others.

I originally followed this tutorial: php webservice with nusoap and c#. Only thing he doesn't say in the tutorial is that you should put all the php code in one php file (but ok, it might be just straightforward really, so no real complaints on that one).

I first tried this on http, and I was happy it worked, but later I had to move to ssl, and since I was testing it on my local server I had a selfsigned certificate, and I got the error: "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."

I googled and finally found the solution on this link here: damir dobric blog

Basically you should add the line:

ServicePointManager.ServerCertificateValidationCallback += 
new System.Net.Security.RemoteCertificateValidationCallback(
customXertificateValidation);

and add the implementation of the function customXertificateValidation to return true (this is what I did for testing purposes).

Ok, I do hope this helps someone, cause it got me stressed for a week!



来源:https://stackoverflow.com/questions/3116419/nusoap-with-https

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!