Close

August 9, 2017

Debugging SOAP Issues

We recently had a very strange php SOAP issue that cropped up right after an upgrade to PHP on a development server took place.  It was a basic SOAP call to Fedex webservices that had always worked before.

After some precursory debugging, we found that the main error was “Uncaught SoapFault exception: [HTTP] Could not connect to host”.
It was strange, since we could easily CURL a response to the same Fedex HTTPS url without any issue.

Having a hunch it may be SSL related, we setup the SOAP call to ignore SSL Cert lookups/etc.

$client = new SoapClient($wsdl, array(
    //'trace' => 1,
    'stream_context' => stream_context_create(array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false, 
            'allow_self_signed' => true //can fiddle with this one.
        )
    ))
 ));

To confirm our suspicions, the call started working right away. Doing a bit of digging on Stack Overflow, we found another person had been hit with the same issue ( Answer