0

I recently changed my dev-environment from Windows 10 to Ubuntu 16.04 (virtual in vmware player). Since then i got problems with PHP SoapClient calls. The following script was running well under Windows 10 (XAMPP) and also works on my online-server (Plesk-Onyx under Ubuntu) but not in the VM.

<?
ini_set ('soap.wsdl_cache_enabled', 0);
ini_set ('soap.wsdl_cache_ttl', 0);

$wsdl_file = 'soap/stage.wsdl';
$soap_param = array (
    'location'              => 'https://.../Service.asmx',
    'local_cert'            => 'soap/stage.pem',
    'login'                 => 'USERNAME',
    'password'              => 'PASSWORD',
    'soap_version'          => SOAP_1_2,
    'exceptions'            => True,
    'trace'                 => 1,
    'connection_timeout'    => 15
);

try {
    $soap_client = new SoapClient ($wsdl_file, $soap_param);
    $soap_client -> __call ('SOME_FUNCTION', array ()); //failing
} catch (Exception $e) {
    echo $e -> getMessage ().'<br>';
}
?>

The line $soap_client -> __call ('SOME_FUNCTION', array ()); throws the error-message: Could not connect to host

I tried various fixes i found on the internet but nothing worked. SELinux and firewalls on guest and host are disabled. What am i missing? Thanks in advance.

UPDATE:

I still have not found a solution. But by inspecting the sent request (using $soap_client -> __getLastRequest () and $soap_client -> __getLastRequestHeaders ()) it appears that the following informations are missing in the request-header:

Host: SERVICE_HOST
Connection: Keep-Alive
User-Agent: PHP-SOAP/7.1.1
Content-Type: application/soap+xml; charset=utf-8; action="URL/SOME_FUNCTION"
Content-Length: 208
Authorization: Basic BASE64_STRING

Can anybody confirm that this might be the problem?

wayneOS
  • 1,427
  • 1
  • 14
  • 20

0 Answers0