“Error Fetching http body” with php SoapClient

自闭症网瘾萝莉.ら 提交于 2019-12-20 01:41:21

问题


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' => 'me@mail.com',
    '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


回答1:


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:


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",
                ),
            )
        ),
    )
);


来源:https://stackoverflow.com/questions/10652705/error-fetching-http-body-with-php-soapclient

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!