PHP 5.3.6 SoapClient :: __ doRequest (): SSL: connection reset from user

I am working on consuming .net web service in php 5.3.6. I am using the SoapClient class to connect. It continues to fail with " SoapClient :: __ doRequest (): SSL: connection reset by peer " and " SoapFault object ([message: protected] => Error Retrieving http headers ".

This only happens for methods / operations. If I use $ response = $ objClient → __ getFunctions (); and it works fine, and I get the answers without any problems.

$objClient = new SoapClient("http://sample.idws.syndication.kbb.com/3.0/VehicleInformationService.svc?wsdl", array('trace' => 1, 'username' => 'xxxxxxx', 'password' => 'xxxxxxx', 'soap_version' => SOAP_1_2, 'exceptions' => true )); 

PHP: php 5.3.6 using ssl soap.
OS: Ubuntu 11.10

+3
source share
3 answers

. , , -wsdl http://php.net/manual/en/soapclient.soapclient.php wsdl.

-wsdl

    $soapx = new SoapClient(null,
            array(
        "trace" => true,
        'cache_wsdl' => WSDL_CACHE_NONE,
        'location' => 'http://remote_wsdl_url',
        'uri' => 'http://necessary_uri',
        'use' => SOAP_LITERAL,
        'style' => SOAP_DOCUMENT,));

wsdl

    $soapx = new SoapClient('http://remote_wsdl_url_turned_to_local',
            array(
        "trace" => true,
        'cache_wsdl' => WSDL_CACHE_NONE,));
+1

, SOAP Server. - SOAP - soapclient .

0

I recently ran into this on the same issue. For us, the problem was using the SSL protocol. We needed to force TLS 1.1, and it all started to buzz. The key working component for us here is crypto_method.

$wsdl = 'PATH/TO/WSDL';
$url = 'http://URL_TO_SOAP_SERVICE';
$cert = 'PATH/TO/CLIENT/CERT';

$context = stream_context_create([
    'ssl' => [
        'crypto_method' =>  STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT,
        'verify_peer' => true,
        'verify_peer_name' => true,
        'allow_self_signed' => false,
        'cafile' => '/path/to/cafile.selfsigned'
    ]
]);

$params = [
    'location' => $url,
    'local_cert' => $cert,
    'trace' => true,
    'exceptions' => true,
    'verifypeer' => true,
    'verifyhost' => true,
    'allow_self_signed' => false,
    'connection_timeout' => 180,
    'keep_alive' => false,
    'stream_context' => $context
];

$client = new SoapClient($wsdl, $params);
0
source

All Articles