-->

Nusoap with https

2019-05-27 01:39发布

问题:

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 nusoap