4

我在使用 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 Content-Location: http:// ** ** /general/html/pages/layouts/columnContent.jsp 内容语言:de-DE 内容类型:text/html;charset=UTF-8 日期:2012 年 5 月 18 日星期五 15:50:01 GMT 传输编码:分块连接:保持活动连接:传输编码集 Cookie:JSESSIONID=0a6d28f530d798c4676f59494491a82035d98e25ff6f.e38Ka38Sax4TbO0MaheKbhaTbh8Te6fznA5Pp7ftolbGmkTy;path=/ 缓存控制:私有

最后一个请求标头:POST /html/de_DE/index_DE/index.html HTTP/1.1 主机:. ***连接:Keep-Alive 用户代理:PHP-SOAP/5.2.13 内容类型:text/xml;charset=utf-8 SOAPAction: "" Content-Length: 937 Authorization: Basic c3RyZ19ka29zaGF2ZTpsNFB3TVZqDlRhZUc1cg== Cookie: JSESSIONID=0a6e28e930d70301b8f6dd3e8a2598bff7cef065809a.e38Pa3mLbx4Oci0Mah4Qb34TbxmOe6fznA5Pp7etoltGmkTy;BIGipServerPirobase=254438666.20480.0000;

PHP版本:5.2.13

4

2 回答 2

15

尝试使用 PHP 5.3

$client = new SoapClient("< some url  >", 
    array(
        'trace' => 1,
        'stream_context' => stream_context_create(
            array(
                'http' => array(
                    'protocol_version' => 1.0,
                ),
            )
        ),
    )
);
于 2012-08-16T22:38:37.620 回答
2

在 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",
                ),
            )
        ),
    )
);
于 2016-02-04T11:12:20.470 回答