L
L
lostinvlg2016-08-19 10:08:11
PHP
lostinvlg, 2016-08-19 10:08:11

PHP SOAP and certificate?

When changing the version of php5.5 to php5.6/php7 (both on vds and local), the soap client of one of the projects falls off.

<?php
$wsdl = 'https://site.com/webservice/service.svc/wsdl?wsdl';
$soap = new SoapClient($wsdl, ["soap_version" => SOAP_1_1]);
var_dump($soap);

Prior to <=php5.5:
Object(SoapClient)#3 (2) { ["_soap_version"]=> int(1) ["sdl"]=> resource(16) of type (Unknown) }
Starting with 5.6:
"Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from ' https://site.com/webservice/service.svc/wsdl?wsdl ' : failed to load external entity " https://site.com/webservice/service.svc/wsdl?wsdl "
Through the wsdl browser, the document opens normally.
In the first case, file_get_contents() gets the document, for php >=5.6 the error is:
"Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in"
It turns out that obtaining a document requires a certificate?
Has anyone experienced something similar?
PS curl, openssl, libxml installed and enabled in php.ini.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Max, 2016-08-19
@lostinvlg

$wsdl = 'https://site.com/webservice/service.svc/wsdl?wsdl';
$soap = new SoapClient($wsdl, [
    "soap_version" => SOAP_1_1,
    "stream_context" => stream_context_create(
            [
                'ssl' => [
                    'verify_peer'       => false,
                    'verify_peer_name'  => false,
                ]
            ]
        )
]);
var_dump($soap);

U
urfinjazz, 2018-02-04
@urfinjazz

can someone help ... solved the problem by increasing the default_socket_timeout
error appeared when default_socket_timeout < 3, including the value -1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question