1

I'm having the situation where I try to connect to a SSL host via SOAP in a Docker Application.

When trying to do so, I have to disable SSL on transport level in order to get it working. I'm using code like this:

$context = stream_context_create([
    'ssl' => [
        // set some SSL/TLS specific options
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    ]
]);

$client  = new SoapClient(null, [
    'location' => 'https://...',
    'uri' => '...', 
    'stream_context' => $context
]);

Which is also the most upvoted answer on this question.

So, what I'd like to achieve is to get the connection running without this hack.

If I leave this out, I receive the following exception:

( ! ) Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://api.myhost.tld/gateway/Method?wsdl' : failed to load external entity "https://api.myhost.tld/gateway/Method?wsdl" in /var/www/html/app/code/local/Vendor/MyHost/Model/Method.php on line 31
Atr_Max
  • 269
  • 1
  • 4
  • 20

1 Answers1

1

You need trusted certificate for your domain api.myhost.tld to make it right. So you can buy "official" SSL certificate and attach that to your SOAP webserver or create self signed certificate and add that cert as trusted in your docker image like described there: How do I add a CA root certificate inside a docker image?

Jakub Bujny
  • 4,400
  • 13
  • 27
  • How would I get access to a 3rd party SSL certificate? 'api.myhost.tld' is actually not my host, its a foreign one that I have no further access to. – Atr_Max Sep 03 '18 at 13:34
  • So if that host use self-signed certificate just export that certificate using one of proposed method there: https://support.google.com/gsa/answer/6345106?hl=en and add that certificate as trusted to CA like in link which I provided in answer – Jakub Bujny Sep 03 '18 at 13:52
  • That did the Job! :) – Atr_Max Sep 03 '18 at 14:14