2

I try to get customer datas via a PHP script and the Magento 1 SOAP API. At my development system, every thing is works well.

But now when I try to use it at the online Shop with active SSL, I get no connections to the wsdl object.

My PHP call

$wsdl = 'https://urltoshop/api/v2_soap/index/?wsdl=1';
$user = 'soapuser';
$pass = 'paasword';
...
//options for ssl in php 5.6.5
$opts = array(
    'ssl' => array(
            'ciphers' => 'SHA-256',
            'verify_peer' => false,
            'verify_peer_name' => false
    )
);
// SOAP 1.2 client
$params = array(
    'encoding' => 'UTF-8',
    'verifypeer' => false,
    'verifyhost' => false,
    'soap_version' => SOAP_1_2,
    'trace' => 1,
    'exceptions' => 1,
    'connection_timeout' => 180,
    'stream_context' => stream_context_create($opts)
);
$proxy = new SoapClient($wsdl);
... 
try {
   $sessionId = $proxy->login($user, $pass);
} catch (Exception $e) {
   $sessionId = null;
   echo $e->getMessage();
}

And I get always the error message like this:

SoapFault: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://urltoshop/api/v2_soap/index/?wsdl=1' : failed to load external entity

This url works in a webbrowser, and I get the xml structure. I have already try a lot of SoapClient options like:

'verifyhost' => false, 
'verify_peer' => false, '
'verify_peer_name' => false 
 'ssl' => array('allow_self_signed' => true)); 

etc...

But nothing works for me.

Is this a problem with my PHP script, or a config problem in my Apache Webserver? Or something in the Magento configuration?

Has any of you guys any experience with such a constellation like this?

Does everyone know a good manual page, how to setup the SOAP API in Magento incl. a https:// connection?

2 Answers 2

2

I´ve found the problem with the connection failure. For those who running in the same problems:

In my case there was missing the intermediate certificate in the webserver. This was not a problem for the web Browser, but for the SOAP client.

When I checked the installed certificate with (https://www.sslshopper.com/ssl-checker.html), I got a result like this: enter image description here

After I had insert the intermediate certificate content, everything was working well.

0

The correct way to define the properties is

$paramsSoap = array(
                        "trace" => 1,
                        "location" => "<your-url>",
                        'exceptions' => 1,
                        "stream_context" => stream_context_create(
                            array(
                                'ssl' => array(
                                    'verify_peer'       => false,
                                    'verify_peer_name'  => false,
                                )
                            )
                        )
                    );
    
    $client = new SoapClient("<your-url>?wsdl",$paramsSoap);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.