preload preload


Uncaught SoapFault exception: [HTTP] Error Fetching http headers

PHP SOAP extension sometime returns “[HTTP] Error Fetching http headers” when using PHP SoapClient to call the SOAP webservice. The reason for this error is the SOAP webservice took more time to respond than expected.

Solution

To fix this error, we can increase the either increase the socket timeout “default_socket_time” in php.ini or add the connection_timeout parameter in the parameter array passed to the constructor of the SoapClient. These parameter are in seconds.

1. In php.ini

default_socket_timeout = 120

Alternatively, you can change from code

ini_set('default_socket_timeout', 120);

Note: The default socket timeout in php is 60 seconds.

2. “connection_timeout” parameter in SoapClient constructor

$client = new SoapClient($wsdl, array('connection_timeout' => 120));

Hope this will save your time.

Liked the content? Then why not share with your pals

  • 3 responses to "Uncaught SoapFault exception: [HTTP] Error Fetching http headers"

  • WP Themes
    22:40 on July 24th, 2010

    Good post and this post helped me alot in my college assignement. Thanks you for your information.

  • Cassiano Surek
    17:06 on November 3rd, 2010

    This is unfortunately not working for me. I have increased timeouts and still the error persists.

  • Deepesh
    12:28 on November 4th, 2010

    In that case, I would suggest you to use Firefox poster or SoapUI software to send the SOAP request to the server and check whether everything is working good and what is time taking by the SOAP server to respond.

  • Leave a Reply

    * Required
    ** Your Email is never shared