A friend is developing a 3rd party soap client with PHP 5.x. The client is already complete, and worked properly on the server (Debian+Apache) connecting to the dev endpoint. Now he wants to change to production endpoint and certifications, but always got the "could not connect to host" error message without any explanation. The same code with the same certs works from localhost or even from Firefox with imported cert. Only the SoapClient from the server does not want to connect to it. According to him the error is almost instant, so it is not some kind of timeout. He tried to telnet the endpoint from the server and it has connected, so it is not a firewall problem. He already mailed to the webservice maintainer to get the logs, but no response yet. Any idea what can cause such environment dependent issues by SOAP?
Here is the code, but I guess it does not contains any info to solve this:
$soapLocation = (DEV_ENV ? 'https://dev.example.com:443' : 'https://prod.example.com:443').$soapLocationUri;
$soapClient = new SoapClient(
'./wsdl/'.$wsdlFileName,
array(
'local_cert' => (DEV_ENV ? './cert/***.pem' : './cert/***.pem'),
'passphrase' => (DEV_ENV ? 'xxx' : 'xxx'),
'location' => $soapLocation,
'trace' => true,
'exceptions' => true,
'keep_alive' => true,
'connection_timeout' => 10,
'cache_wsdl' => WSDL_CACHE_NONE,
'soap_version' => SOAP_1_1,
'stream_context' => stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
))
)
);
and the exception:
object(SoapFault)#2 (9) {
["message":protected]=>
string(25) "Could not connect to host"
["code":protected]=>
int(0)
["trace":"Exception":private]=>
array(2) {
[0]=>
array(6) {
["function"]=>
string(11) "__doRequest"
["class"]=>
string(10) "SoapClient"
["args"]=>
array(4) {
[0]=>
string(1188) "...xml..."
[1]=>
string(53) "https://prod.example.com:443/BLAH/BLAH_NO_SAML"
[2]=>
string(0) ""
[3]=>
int(1)
}
}
...
}
["previous":"Exception":private]=>
NULL
["faultstring"]=>
string(25) "Could not connect to host"
["faultcode"]=>
string(4) "HTTP"
}