Hola a todos, necesito consumir un webservice, este el codigo que tengo.
Código PHP:
<?php
//header("Content-Type: text/xml; charset=utf-8");
$xml = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<OTA_HotelAvailService xmlns="http://www.opentravel.org/OTA/2003/05">
<OTA_HotelAvailRQ PrimaryLangID="%LANGUAGE%">
<POS>
<Source AgentDutyCode="*****">
<RequestorID MessagePassword="*****"/>
</Source>
</POS>
<AvailRequestSegments>
<AvailRequestSegment>
<StayDateRange Start="2011-11-12" End="2011-11-19"/>
<RoomStayCandidates>
<RoomStayCandidate Quantity="1">
<GuestCounts>
<GuestCount Age="40" Count="1"/>
<GuestCount Age="5" Count="1"/>
</GuestCounts>
</RoomStayCandidate>
<RoomStayCandidate Quantity="1">
<GuestCounts>
<GuestCount Age="40" Count="2"/>
</GuestCounts>
</RoomStayCandidate>
</RoomStayCandidates>
<HotelSearchCriteria>
<Criterion>
<HotelRef HotelCityCode="%CITY_CODE%" HotelCode="%HOTEL_CODE%"/>
<TPA_Extensions>
<ShowBasicInfo xmlns="">1</ShowBasicInfo>
<ShowPromotions xmlns="">1</ShowPromotions>
</TPA_Extensions>
</Criterion>
</HotelSearchCriteria>
</AvailRequestSegment>
</AvailRequestSegments>
</OTA_HotelAvailRQ>
</OTA_HotelAvailService>
</soap:Body>
</soap:Envelope>';
$url = 'http://xml.bookingengine.es/webservice/OTA_HotelAvail.asmx?wsdl';
$header = array();
$header[] = 'Content-Type: text/xml;charset=UTF-8';
$header[] = 'SOAPAction: "http://www.opentravel.org/OTA/2003/05/OTA_HotelAvailService"';
$header[] = 'Accept-Encoding: gzip,deflate';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
$data = curl_exec($ch);
curl_close($ch);
echo $data;
y esto es lo que imprime :
‹í½`I–%&/mÊ{JõJ×àt¡€`$Ø�@ìÁˆÍæ’ìiG#)«*�ÊeVe]f@Ìí�¼÷Þ{ï½÷Þ{ï½÷º;�N'÷ßÿ?\fdlöÎJÚÉž!€ªÈ?~|?" ÿïez™×MQ-?ûhw¼óQš/§Õ¬X^|öѺ=ß>øè÷8zÜTÙêÑéò2/«UžÒ+Ëæ>ûì£yۮݽÛLçù"kÆô>WõÅ]ür7×—î~¤¯½k ûÖÕÕÕøê7ÞÛÙÙ½û{ñü5Ú.–M›-§¹{kvó[)¢OªÙõÑã/ßÿþ߮ڼ<¾ÌŠòu^_ÓüUÞ¬ªe£c@’˶Î]M¯ü½»;÷ .ýå{õ:}S,ò×m¶ ìíìînï<ÜÞ;x³ûàѽ�G÷wÇ»{?ÙÙ{´CäüêÕsÛõ:žTÕ[¢n¾¼(–ù8oî^å“F°C§^7ã¬Y¼û=®šYùQz¶lOªYþÙGçß}9›}qpšÏÚ/.¾ýûü¢×óï¼*®>ûŒ�<*ëªnôç›kš)üóÙGùòõéÉW¯ÎÞü>§¯^}”¾žW uû&×~öQú¼",Òsê¬I·©“ˬ,féšðI«:]eMsUÕ³�RéûìÅO??{úûõúôÕïÿå«ßÿåñë×ßýòÕÓ�Ò»G�ïr·Ô}g ¯^÷>êL}ïÍ›ün˜íè7Nþ ü¥:¤
Ayuda!!, no se que hacer!!