Error Fetching http headers SOAP

Tigran Muradyan picture Tigran Muradyan · Oct 2, 2014 · Viewed 7.1k times · Source

i have a problem with SOAP, havent found a real answer.

try {
    $objResponse = $objSoapClient->$strMethod($objMethod->getSoapRequest());
}
catch (SoapFault $e) {  
    GlobalLogState::write("exception with code(".$e->getCode()."): \n".$e->getMessage());
}

This is my simple SOAP request in try catch block.

I'm getting a SoapFault Exception:

Error Fetching http headers

What is the reason of that?

Answer

Marcelo Tonon Chiovatto picture Marcelo Tonon Chiovatto · Nov 30, 2017

The configuration that has worked for me was defining at my php script the following parameters:

    ini_set('default_socket_timeout', 5000);
    $client = new \SoapClient($url,array(
    'trace' =>true,
    'connection_timeout' => 5000,
    'cache_wsdl' => WSDL_CACHE_NONE,
    'keep_alive' => false,
));

Please, comment.

The most important parameter definition, as per my experience with this issue was ini_set('default_socket_timeout', 5000);

During my tests I have defined the default_socket_timeout to 5 seconds and the error 'Error Fetching http headers' was raised instantaneously.

I hope it helps you.