-1

我正在尝试使用杜松肥皂网络服务,但我收到错误以下是我正在使用的代码

 $client = new SoapClient('http://xml2.bookingengine.es/WebService/JP/WebServiceJP.asmx?WSDL', array("trace" => 1, "exception" => 1));$parameters = [
    'HotelListRQ' => [
        'version' => '1.1',
        'language' => 'en',
        'login' => ['email' => 'Email@email.com', 'password' => 'xxxxxxxx'],
        'HotelListRequest' => ['ZoneCode' => '55153']    ]]; 
$bookingList = $client->HotelList($parameters);
echo json_encode($bookingList);

输出是

{"HotelListRS":{"Errors":{"Error":{"Text":" 请在您的请愿书中添加 'Accept-Encoding: gzip, deflate' 标头。这样可以将传输时间和响应大小减少约 75 -95%。在此处查看更多信息:http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html","Code":"COMPRESSION_REQUIRED"}},"Url":"http://xml2. bookingengine.es","TimeStamp":"2017-10-18T13:21:09.69911+02:00","IntCode":"lTi3rTnUmlR/a7qZHG2RbvurJ1USoOdKCz2UX3Y19y0="}}

4

2 回答 2

0

请在标题中添加以下行:

"Accept-Encoding": "gzip, deflate"

并且不要忘记在您的请求中将编码设置为 null。最后解压缩响应,因为它是 gzip 格式。

于 2017-11-07T08:14:01.343 回答
0

它适用于这样的 SOAP 客户端定义

   $client = new SoapClient(
        'http://xml2.bookingengine.es/WebService/JP/WebServiceJP.asmx?WSDL',
        array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE, 'trace' => 1)
    );
于 2017-11-14T06:01:24.740 回答