1

I am trying to do a SOAP request with PHP to a server, but all I'm getting is 'Could not connect to host" when running

$this->client->__soapCall("aMethod()", [$request_param_array]));

I think the WSDL is fine, since I can reach it in my browser and when running

$this->client->__getFunctions();

I do receive a list of available functions (as specified in this wsdl).

I do need a certificate to do SOAP calls to that server, so maybe that's the problem? But I don't know how I can debug what causes this "Could not connect to host" error.

Any ideas what can cause this error to occur or how I can find the problem?

My code so far:

public function __construct($url, $wsdl = null)
{
    $this->wsdl = $wsdl != null ? $wsdl : $url . '?wsdl';

    $this->client = new SoapClient($this->wsdl, array(
        "trace" => "1",
        "local_cert" => realpath(__DIR__ . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "..") . "cert.pfx",
        "passphrase" => "admin",
    ));
    Log::info(sprintf("New SoapClient created with WSDL: '%s'", $this->wsdl));
}
Kevin
  • 2,760
  • 3
  • 15
  • 30
  • Possible duplicate of [How to dump SoapClient request for debug?](https://stackoverflow.com/questions/14030228/how-to-dump-soapclient-request-for-debug) – wp78de Jul 14 '18 at 03:14

1 Answers1

2

I've used SoapUI later on to debug a little bit more around these SOAP related problems. SoapUI gave me an 'SSL Handshake' exception. It turned out to be an invalid private key certificate that did not match the public key certificate on the SOAP server I was connecting to.

Though, I still don't see how I can debug problems like this in PHP. Any ideas? Let me know.

Kevin
  • 2,760
  • 3
  • 15
  • 30