0

Scenario: SOAP request via SSL from my localhost to external server.

PHP version: 5.6.3

First attempt:

$options    = array (
    'encoding'              => 'UTF-8', 
    'stream_context'        => stream_context_create(array(
        'ssl' => array(
                'verify_peer'       => false,
                'verify_peer_name'  => false,
                'allow_self_signed' => true,
            )
        )
    ),
);
$client = new SoapClient('https://www.???.es/index.php/api/soap?wsdl', $options);

Error: SOAP-ERROR: Parsing WSDL

Suggested solution found here by tobik (do request with a WDSL file previously downloaded)

Second atttempt:

$filename = 'test.wsdl';
$uri = dirname(__FILE__) . DIRECTORY_SEPARATOR .$filename;
$options    = array (
    'encoding'              => 'UTF-8', 
    'location'              => 'https://www.???.es',
    'uri'                   => $uri,
    'stream_context'        => stream_context_create(array(
        'ssl' => array(
                'verify_peer'       => false,
                'verify_peer_name'  => false,
                'allow_self_signed' => true,
                'cache_wsdl' => WSDL_CACHE_NONE,
            )
        )
    ),
);
$client = new SoapClient(null, $options);

Error: Uncaught SoapFault exception: [Client] looks like we got no XML document in ...

Community
  • 1
  • 1
jj-aa
  • 1,019
  • 5
  • 19
  • 39

1 Answers1

0

Finally solved adding

openssl.cafile=/etc/ssl/certs/ca-bundle.crt

to the php.ini

jj-aa
  • 1,019
  • 5
  • 19
  • 39