4
votes

I have some trouble submitting user data to a server by using Soap. All i get is:
Error Fetching http body, No Content-Length, connection closed or chunked data Am i doing something wrong?

$client = new SoapClient(APPPATH.'my.wsdl',array(
    'login' => 'user',
    'password' => 'pass',
    'location' => 'http://gimmeyadata.com/crm/regserv?wsdl',
    'trace' => true,
    )
);
$result = $client->register(array(
    'Email' => '[email protected]',
    'Gender' => 'm',
    'First name' => 'Oliver',
    'Last name' => 'Liermann',
    'Language code' => 'de-de',
));

Last response header: HTTP/1.1 200 OK X-SiteConfidence: jenppb601 Content-Location: http://.***.*/general/html/pages/layouts/columnContent.jsp Content-Language: de-DE Content-Type: text/html;charset=UTF-8 Date: Fri, 18 May 2012 15:50:01 GMT Transfer-Encoding: chunked Connection: keep-alive Connection: Transfer-Encoding Set-Cookie: JSESSIONID=0a6d28f530d798c4676f59494491a82035d98e25ff6f.e38Ka38Sax4TbO0MaheKbhaTbh8Te6fznA5Pp7ftolbGmkTy; path=/ Cache-Control: private

Last request header: POST /html/de_DE/index_DE/index.html HTTP/1.1 Host: .**.* Connection: Keep-Alive User-Agent: PHP-SOAP/5.2.13 Content-Type: text/xml; charset=utf-8 SOAPAction: "" Content-Length: 937 Authorization: Basic c3RyZ19ka29zaGF2ZTpsNFB3TVZqDlRhZUc1cg== Cookie: JSESSIONID=0a6e28e930d70301b8f6dd3e8a2598bff7cef065809a.e38Pa3mLbx4Oci0Mah4Qb34TbxmOe6fznA5Pp7etoltGmkTy;BIGipServerPirobase=254438666.20480.0000;

PHP Version: 5.2.13

2
Which PHP version are you using, and if you enable the soap trace, please post the response header.hakre

2 Answers

15
votes

try PHP 5.3 with

$client = new SoapClient("< some url  >", 
    array(
        'trace' => 1,
        'stream_context' => stream_context_create(
            array(
                'http' => array(
                    'protocol_version' => 1.0,
                ),
            )
        ),
    )
);
2
votes

With PHP 5.4.4, it didn't work without Transfer-Encoding: chunked :

$client = new SoapClient("< some url  >", 
    array(
        'trace' => 1,
        'stream_context' => stream_context_create(
            array(
                'http' => array(
                    'protocol_version' => 1.0,
                    'header' => "Transfer-Encoding: chunked\r\n",
                ),
            )
        ),
    )
);