Error fetching http headers in SoapClient

前端 未结 15 1094
抹茶落季
抹茶落季 2020-12-08 18:50

I\'m trying to invoke a WS over https on a remote host:remote port and I get:

Error fetching http headers

using the PHP5 SoapCli

15条回答
  •  难免孤独
    2020-12-08 19:26

    I faced same problem and tried all the above solutions. Sadly nothing worked.

    1. Socket Timeout (Didn't work)
    2. User Agent (Didn't work)
    3. SoapClient configuration, cache_wsdl and Keep-Alive etc...

    I solved my problem with adding the compression header property. This is actually required when you are expecting a response in gzip compressed format.

    //set the Headers of Soap Client. 
    $client = new SoapClient($wsdlUrl, array(
        'trace' => true, 
        'keep_alive' => true,
        'connection_timeout' => 5000,
        'cache_wsdl' => WSDL_CACHE_NONE,
        'compression'   => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,
    ));
    

    Hope it helps.

    Good luck.

提交回复
热议问题