First time in my life trying to achieve implement wsdl service into web site. I am getting following response from service. I tried to parse response with following code but probably doing something wrong in somewhere. Could anyone help me to parse certain nodes from response?
Regards and Thanks
$xml = simplexml_load_string($result);
$hotels = $xml->children('http://schemas.xmlsoap.org/soap/envelope')->Body->children('http://axis.frontend.hydra.hotelbeds.com')->hoteldetailrs->hotel;
foreach ($hotels as $hotel) {
echo '
<hoteldetails>
<h1>' .$hotel->name . '</h1>
<h2>' .$hotel->code . '</h2>
</hoteldetails>
';
}
Soap Response
<!--?xml version="1.0" encoding="utf-8"?-->
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:body>
<ns1:gethoteldetail xsi:type="xsd:string" xmlns:ns1="http://axis.frontend.hydra.hotelbeds.com">
<hoteldetailrs xmlns="http://www.hotelbeds.com/schemas/2005/06/messages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.hotelbeds.com/schemas/2005/06/messages HotelDetailRS.xsd" echotoken="DummyEchoToken">
<auditdata>
<processtime>7</processtime>
<timestamp>2014-09-01 13:39:27.027</timestamp>
<requesthost>78.135.9.124</requesthost>
<servername>FORM</servername>
<serverid>FO</serverid>
<schemarelease>2005/06</schemarelease>
<hydracorerelease>2.0.201408281727</hydracorerelease>
<hydraenumerationsrelease>1.0.201408281727</hydraenumerationsrelease>
<merlinrelease>N/A</merlinrelease>
</auditdata>
<hotel xsi:type="ProductHotel">
<code>50</code>
<name>Aquahotel Aquamarina</name>
<descriptionlist>
<description type="HotelDescription" languagecode="ENG" languagename="Ingles">This attractive beach hotel is located on the sea front promenade of Santa Susanna, only 100 m from the beach. In the vicinity there are shops, bars, restaurants and night clubs. Girona Airport is 30 km away, Airport Barcelona-El Prat 60 km. The centre of Barcelona can be reached by train, calling at Plaça Catalunya. The hotel features 601 rooms, 24-hours reception, currency exchange, conference facilities, TV room, restaurant, 4 bars, outdoor pool, children's pool, playground, mini-club, cinema, supermarket and hairdresser. Facilities for disabled guests.</description>
</descriptionlist>
<contact>
<address>
<streettypeid>.</streettypeid>
<streettypename> </streettypename>
<streetname>AVENIDA DEL MAR</streetname>
<number>16</number>
<postalcode> 08398</postalcode>
<city>SANTA SUSANA</city>
<countrycode>ES</countrycode>
</address>
<emaillist>
<email>aquahotel@aquahotel.com</email>
</emaillist>
<phonelist>
<contactnumber type="phoneHotel">937678060</contactnumber>
<contactnumber type="phoneBooking">902206306</contactnumber>
</phonelist>
<faxlist>
<contactnumber>937678137</contactnumber>
</faxlist>
<weblist>
<web>www.aquahotel.com</web>
</weblist>
</contact>
<category type="SIMPLE" code="4EST" shortname="4*">4 STARS</category>
<destination type="SIMPLE" code="LLM">
<name>Costa Brava & Costa Barcelona-Maresme</name>
<zonelist>
<zone type="SIMPLE" code="15">Santa Susana</zone>
</zonelist>
</destination>
<position latitude="41.63434" longitude="2.72169"></position>
</hotel>
</hoteldetailrs>
</ns1:gethoteldetail>
</soapenv:body>
</soapenv:envelope>