title: PHP SOAP "Error Fetching http body ... or chunked data" On FedEx Rate Service
body: <p>I am getting "Error Fetching http body, No Content-Length, connection closed or chunked data" when doing a SOAP request to the Fedex Rate service.  </p>
  
  <p>Running Apache 2.4.4, PHP 5.4.12.
  This code is working on a different server, which is running Apache 2.2.3, PHP 5.3.27.</p>
  
  <p>Here is my PHP code: </p>
  
  <pre><code>require_once('fedex-common.php5');
  $path_to_wsdl = __DIR__ . "/RateService_v10.wsdl";
  ini_set( "soap.wsdl_cache_enabled", "0" );
  
  $context = stream_context_create(array(
      'http'=&gt;array(
          'protocol_version' =&gt; 1.0
      )
  ));
  
  $client = new SoapClient( $path_to_wsdl, array( 'trace' =&gt; 1,  'stream_context'=&gt;$context ) ); 
  
  ...
  
  try {
      ...
      $response = $client-&gt;getRates( $request );
      ...
  } catch ( SoapFault $exception ) {
      echo($client-&gt;__getLastRequestHeaders());
      echo($client-&gt;__getLastResponseHeaders());
      printFault( $exception, $client );
  }
  </code></pre>
  
  <p>Running the code gives the following headers in the catch block -
  Request:</p>
  
  <pre><code>POST /web-services/rate HTTP/1.1
  Host: ws.fedex.com
  Connection: Keep-Alive
  User-Agent: PHP-SOAP/5.4.12
  Content-Type: text/xml; charset=utf-8
  SOAPAction: "getRates"
  Content-Length: 3875
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Date: Thu, 31 Oct 2013 19:12:23 GMT
  Server: Apache/2.2
  x-wily-servlet: Encrypt1 GaMcoOotgOSMyoYj73M4dqm654IQUUy2VYo7kRLnWqp7O1G9YaZThSMVcxtIAA7cQSSESAO/CtqxI1OyaPemJzOZK7N+WNRwu686y5jWfxAuKqFeRiYJ1NPQTJShYPzp7gOpypOE/sg3Ti/CjdT3XaNt6/pEd18+pXDMyIfKrxnz4xWyAOl9y4Rosae418ks0PYNS9GJy2iOfaSXRiWFkA==
  X-Powered-By: Servlet/2.5 JSP/2.1
  x-wily-info: Clear guid=0FEE460DCC8738E20EC18F87798CDA26
  Vary: Accept-Encoding
  Keep-Alive: timeout=8, max=1024
  Connection: Keep-Alive
  Transfer-Encoding: chunked
  Content-Type: text/xml; charset=utf-8
  </code></pre>
  
  <p>I am confused that the request is being made with HTTP/1.1 when I specify HTTP/1.0 (per recommendations on other questions).  Also in the response header, it's definitely returning chunked data, causing that error.  When I run the request myself in Advanced REST client (chrome extension), it works correctly, but also includes the <code>Transfer-Encoding: chunked</code> header that I believe is causing the problem.</p>
  
  <p>I suspect there is some kind of issue with my Apache or PHP configuration.  </p>
  
  <p>Solution: Downgrading to Apache 2.2.22 and PHP 5.3.13 fixed the issue</p>