php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68431 Error Fetching http headers
Submitted: 2014-11-17 00:03 UTC Modified: -
Votes:6
Avg. Score:4.7 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:0 (0.0%)
From: james at auderecommerce dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.6.3 OS: Windows 8.1 Pro x64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: james at auderecommerce dot com
New email:
PHP Version: OS:

 

 [2014-11-17 00:03 UTC] james at auderecommerce dot com
Description:
------------
SoapClient is not honouring stream_context_create, and is also returning a cryptic error (Error Fetching http headers).

The error is triggered as PHP is not returning HTTP headers (https://github.com/php/php-src/blob/PHP-5.6.3/ext/soap/php_http.c#L884). However, in SoapUI Pro the request/response is valid (ruling out an error with the server).

Test script:
---------------
$context = stream_context_create(array(
    'http' => array(
        'header' => 'Connection: Close'
    )
));

$client = new Zend\Soap\Client('https://www.example.com/', array(
    'cache_wsdl' => WSDL_CACHE_NONE,
    'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
    'stream_context' => $context
));



$session = $client->login('foo', 'bar'); 
 
$filter = array(
    'complex_filter' => array(
        array(
            'key' => 'created_at',
            'value' => array(
                'key' => 'from',
                'value' => '2014-11-16 01:01:01'
            )
    )
));

$result = $client->salesOrderList($session, $filter);

Expected result:
----------------
POST /index.php/api/v2_soap/index/ HTTP/1.1
Host: www.example.com
Connection: Close
User-Agent: PHP-SOAP/5.6.3
Content-Type: application/soap+xml; charset=utf-8; action="urn:Mage_Api_Model_Server_V2_HandlerAction"
Content-Length: 881
Cookie: PHPSESSID=sessionId;

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope ...

HTTP/1.1 200 OK
Date: Sun, 16 Nov 2014 23:50:50 GMT
Server: Apache
Set-Cookie: PHPSESSID=sessionId; expires=Mon, 17-Nov-2014 00:50:50 GMT; path=/; domain=www.example.com; secure; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding,User-Agent
Content-Length: 7362
Connection: keep-alive, close
Content-Type: text/xml; charset=UTF-8

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope ...



Actual result:
--------------
POST /index.php/api/v2_soap/index/ HTTP/1.1
Host: www.example.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.6.3
Content-Type: application/soap+xml; charset=utf-8; action="urn:Mage_Api_Model_Server_V2_HandlerAction"
Content-Length: 881
Cookie: PHPSESSID=sessionId;

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope ...

HTTP/1.1 200 OK
Date: Sun, 16 Nov 2014 23:48:24 GMT
Server: Apache
Set-Cookie: PHPSESSID=sessionId; expires=Mon, 17-Nov-2014 00:48:24 GMT; path=/; domain=www.example.com; secure; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 580
Connection: keep-alive, close
Vary: User-Agent,Accept-Encoding
Content-Type: text/xml; charset=UTF-8

Empty response / Error Fetching http headers


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-07 06:43 UTC] info at afer dot com dot ar
Im having same issue:

Send headers
POST /wsfev1/service.asmx HTTP/1.1
Host: servicios1.afip.gov.ar
Connection: close
User-Agent: PHP-SOAP/7.0.15-0ubuntu0.16.04.4
Content-Type: application/soap+xml; charset=utf-8; action="http://ar.gov.afip.dif.FEV1/FECAESolicitar"
Content-Length: 2116
Cookie: TS0122d503=0145b27a97c51d3130ad6370db7f421623d37cebc0a47c70b5f5011c46b8b00c284ed18c57;


    
Send body
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://ar.gov.afip.dif.FEV1/"><env:Body><ns1:FECAESolicitar><ns1:Auth><ns1:Token>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgdW5pcXVlX2lkPSI0MTU0OTE2MjUiIHNyYz0iQ049d3NhYSwgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZ2VuX3RpbWU9IjE0OTE1MzYwMDYiIGV4cF90aW1lPSIxNDkxNTc5MjY2IiBkc3Q9IkNOPXdzZmUsIE89QUZJUCwgQz1BUiIvPgogICAgPG9wZXJhdGlvbiB2YWx1ZT0iZ3JhbnRlZCIgdHlwZT0ibG9naW4iPgogICAgICAgIDxsb2dpbiB1aWQ9IkM9YXIsIE89JnF1b3Q7aGVucmlxdWV6IGp1YW4gbWFyY2VsbyxoZW5yaXF1ZXoganVhbiBwYWJsbyZxdW90OywgU0VSSUFMTlVNQkVSPUNVSVQgMzA3MDg0NjE3NjQsIENOPXBjMSIgc2VydmljZT0id3NmZSIgcmVnbWV0aG9kPSIyMiIgZW50aXR5PSIzMzY5MzQ1MDIzOSIgYXV0aG1ldGhvZD0iY21zIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiByZWx0eXBlPSI0IiBrZXk9IjMwNzA4NDYxNzY0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cgo=</ns1:Token><ns1:Sign>RKW3ZL3P9Vo0iACG1KYm/cFhQABFVtdDPR+5shB7Bk74J58J9C+pDvwTONkygsRneqzqK5baAG54wXJ3AazyFCmFvBuCN9VHhQkQErvPRfOWGLN6cPfB4++YwJrmRfZAEEIZxj+AgPQLTAA9QEMSMlLrPyDgFru3oRMHB6qTfmc=</ns1:Sign><ns1:Cuit>30708461764</ns1:Cuit></ns1:Auth><ns1:FeCAEReq><ns1:FeCabReq><ns1:CantReg>1</ns1:CantReg><ns1:PtoVta>2</ns1:PtoVta><ns1:CbteTipo>1</ns1:CbteTipo></ns1:FeCabReq><ns1:FeDetReq><ns1:FECAEDetRequest><ns1:Concepto>1</ns1:Concepto><ns1:DocTipo>80</ns1:DocTipo><ns1:DocNro>30714640506</ns1:DocNro><ns1:CbteDesde>1599</ns1:CbteDesde><ns1:CbteHasta>1599</ns1:CbteHasta><ns1:CbteFch>20170407</ns1:CbteFch><ns1:ImpTotal>510.01</ns1:ImpTotal><ns1:ImpTotConc>0</ns1:ImpTotConc><ns1:ImpNeto>461.55</ns1:ImpNeto><ns1:ImpOpEx>0</ns1:ImpOpEx><ns1:ImpTrib>0</ns1:ImpTrib><ns1:ImpIVA>48.46</ns1:ImpIVA><ns1:MonId>PES</ns1:MonId><ns1:MonCotiz>1</ns1:MonCotiz><ns1:Iva><ns1:AlicIva><ns1:Id>4</ns1:Id><ns1:BaseImp>461.55</ns1:BaseImp><ns1:Importe>48.46</ns1:Importe></ns1:AlicIva></ns1:Iva></ns1:FECAEDetRequest></ns1:FeDetReq></ns1:FeCAEReq></ns1:FECAESolicitar></env:Body></env:Envelope>

    

Response headers
HTTP/1.1 200 OK
Connection: close
Date: Fri, 07 Apr 2017 03:34:26 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 422
Set-Cookie: TS0122d503=0145b27a97c51d3130ad6370db7f421623d37cebc0a47c70b5f5011c46b8b00c284ed18c57; Path=/

    

Response body: empty.

For this case, it seems that I got some response, PHP did not notice and SSL server disconnected my client. Then after that, PHP SOAP triggered SOAPfault.

Using debian wheezy with php 7
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC