使用php SoapClient“获取http正文的错误”

时间:2012-05-18 12:30:42

标签: php soap soa

使用Soap将用户数据提交到服务器时遇到了一些问题。我得到的是:
错误获取http正文,无内容长度,连接已关闭或已分块数据 我做错了吗?

$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',
));

上次回复标题: HTTP / 1.1 200 OK X-SiteConfidence:jenppb601内容 - 位置:http:// ** * * /general/html/pages/layouts/columnContent.jsp内容 - 语言:de-DE Con​​tent-Type:text / html; charset = UTF-8日期:2012年5月18日星期五15:50:01 GMT转码编码:chunked连接:keep-alive连接:Transfer-Encoding Set-Cookie:JSESSIONID = 0a6d28f530d798c4676f59494491a82035d98e25ff6f.e38Ka38Sax4TbO0MaheKbhaTbh8Te6fznA5Pp7ftolbGmkTy; path = / Cache-Control:private

上次请求标头: POST /html/de_DE/index_DE/index.html HTTP / 1.1主机: ** * 连接:Keep-Alive User-Agent :PHP-SOAP / 5.2.13 Content-Type:text / xml;字符集= UTF-8的SOAPAction: “” 内容长度:937授权:基本c3RyZ19ka29zaGF2ZTpsNFB3TVZqDlRhZUc1cg ==曲奇:JSESSIONID = 0a6e28e930d70301b8f6dd3e8a2598bff7cef065809a.e38Pa3mLbx4Oci0Mah4Qb34TbxmOe6fznA5Pp7etoltGmkTy; BIGipServerPirobase = 254438666.20480.0000;

PHP版本:5.2.13

2 个答案:

答案 0 :(得分:12)

使用

尝试PHP 5.3
$client = new SoapClient("< some url  >", 
    array(
        'trace' => 1,
        'stream_context' => stream_context_create(
            array(
                'http' => array(
                    'protocol_version' => 1.0,
                ),
            )
        ),
    )
);

答案 1 :(得分:1)

使用PHP 5.4.4,如果没有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",
                ),
            )
        ),
    )
);