Read More
Read More
Menu Close

    SOAPFault : Error fetching HTTP headers

    SOAP stands for Simple Object Access Protocol, it uses XML to communication as web services. It can work with any application layer protocols. Sometimes when we call a SOAP API, an error appears in response: “Error fetching HTTP headers“. However, when we check our request, all headers seem correct from our end.


    Actually this error message is a little misguiding, since the reason is not the request headers. This error appears in SOAPClient when the response is not fully received from API. This happens when there is timeout error while calling SOAP API.

    For SOAP API calls, there is a PHP setting “default_socket_timeout” which determines maximum time a SOAP request can be alive to transfer data. When there is large data in API response for example if your API returns a paginated list but the page size is very large say 1000, it will take sometime to transfer this amount of data.

    If the default_socket_timeout setting is not enough to complete the transfer of API response, the SOAPClient throws SOAPFaultExceptionError fetching HTTP headers” and terminates the request.


    To fix this issue, we need to increase the default_socket_timeout setting like this:

    Start your headless eCommerce
    Read More
    ini_set('default_socket_timeout', 600);

    The value is in seconds, you can set any value which should be enough for your API response. Alternatively, you can check for possibility if the response can be shortened. For example, in paginated requests, you can reduce page size so that the response is transferred in configured time only. You can also check if the API provides some sort of compression on response which we can use to reduce response size.

    That’s all about fixing this SOAPFault issue. If any doubt in the above process, please feel free to let us know in the comment section.

    I would be happy to help.

    Also, you can explore our PrestaShop Development Services and a large range of quality PrestaShop Modules.

    For any doubt contact us at [email protected].

    . . .
    Discuss on Helpdesk

    Leave a Comment

    Your email address will not be published. Required fields are marked*

    Be the first to comment.

    Back to Top