-1

am trying to consume juniper soap web service but I am getting errors the following is the code I am using

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

and the output is

{"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="}}

2 Answers2

0

Please add the below line in the header:

"Accept-Encoding": "gzip, deflate"

and don't forget to set encoding to null in your request. Finally unzip the response, because it's in gzip format.

jps
  • 20,041
  • 15
  • 75
  • 79
0

it works with the SOAP client definition like that

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