php juniper lot hotel soap 网络服务无法正常工作

php juniper lot hotel soap web service not working

我正在尝试使用 juniper soap Web 服务,但出现错误 以下是我使用的代码

 $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":" Please add the 'Accept-Encoding: gzip, deflate' header in your petition. This can reduce the transmission time and response size by about 75-95%. See more here: 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="}}

请在 header 中添加以下行:

"Accept-Encoding": "gzip, deflate"

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

它与 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)
    );