Php – Error consuming Web Service: :SoapClient(): SSL operation failed with code 1

magentoopensslPHPsoap-clientweb services

I'm trying to consume a Web Services, my friend tested in windows 7 with xampp and is working. He told me he installed a self-signed certificate.
But i'm stuck, i get this error:

Warning: SoapClient::SoapClient(): SSL operation failed with code 1. OpenSSL Error messages:
error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac in /var/www/project/lib/Zend/Soap/Client/Common.php on line 51

Warning: SoapClient::SoapClient(): Failed to enable crypto in /var/www/project/lib/Zend/Soap/Client/Common.php on line 51

Warning: SoapClient::SoapClient(https://url.com/webservice?wsdl): failed to open stream: operation failed in /var/www/eph_me_113/lib/Zend/Soap/Client/Common.php on line 51

Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity "https://url.com/webservice?wsdl" in /var/www/eph_me_113/lib/Zend/Soap/Client/Common.php on line 51

I been tried installing the .cert in my machine with the certutils tools like this:

http://blog.avirtualhome.com/adding-ssl-certificates-to-google-chrome-linux-ubuntu/

After that i see the wsdl in the browser without the red page warning. The browsers tellme that now the "entity is valid". But i'm still having the same error.

I also try adding this in my client.

$opts = array(
        'ssl'   => array(
                'verify_peer'          => false,
                'allow_self-signed' => true,                        
                'ciphers' => "SHA1"
            )
        );
        $streamContext = stream_context_create($opts);

$params = array(    
            'features' => SOAP_SINGLE_ELEMENT_ARRAYS,                
            'stream_context'     => $streamContext,
            'cache_wsdl' => NULL,                    
        );

$client = new SoapClient($url, $params);

I'm very stuck here, so, i hope someone can help me.

Note: I'm using openssl 1.0.1e and Debian 7.

Best Answer

Try downgrading to PHP 5.3 if you happen to have a higher version

Related Topic