Reputation: 221
I want to use PHP's SoapClient to connect to a Webservice that is hosted in a secure HTTP. The server - where this webservice is hosted - does not have a SSL certificate. When I tried to connect using SoapClient, I got following error -
"Warning: SoapClient::__construct() [function.--construct]: SSL: fatal protocol error".
SOAP Fault string -> SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support transport 'http://schemas.microsoft.com/soap/tcp'
SOAP Fault code : WSDL .
try {
$client = new SoapClient('https://mywebservicelink?wsdl', array(
'allow_self_signed' => 1,
'verify_peer' => 0,
'trace' => 1,
'exceptions' => 1,
));
echo 'SOAP OBJECT<br />';
echo '<pre>';
print_r($client);
echo '*****************<br />';
} catch (Exception $e) {
echo '<pre>';
die(print_r($e));
}
Hope this information would be enough. Any one please tell me why I'm getting such an error? Is it because of certificate issue ? certificate (crt file) ?
Thanks for any help
Upvotes: 2
Views: 2536
Reputation: 4500
Your are saying, that server providing service has not installed SSL certificate. Then you ask why you cannot connect to it with secure link https://...
I think you answered the question yourself:-) The server MUST have installed SSL certificate in order to accept secure connection. Otherwise you only can use insecure connection http://...
PHP SoapClient can load WSDL also via secure connection. Actually I am using it on local devel machine with self signed certificate and it works.
Only lately in PHP 5.5+ has been added new parameter ssl_method (possible values: SOAP_SSL_METHOD_TLS, SOAP_SSL_METHOD_SSLv2, SOAP_SSL_METHOD_SSLv3 or SOAP_SSL_METHOD_SSLv23) to specify some kind of peer verification, but I dont have experience with it.
However, if your server has installed SSL certificate and your PHP SoapClient still cannot connect to it, you can adjust stream context to disable peer verification and accept self-signed certificates. See this thread on the topic.
Upvotes: 1