soap - Create raw XML request using PHP SoapClient -


i trying create raw xml request soapvar. here code

#- loading wsdl document   $wsdl = "https://ota2-p1.ihotelier.com/ota_seamless/services/dailyrateservice?wsdl";   $client = new soapclient($wsdl,array('trace' => true, 'exceptions' => true));  #- creating xml document    $xml = <<<eot <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:ota="http://services.ota.travelclick.com"> <soap:header>    <wsa:messageid>86830</wsa:messageid>    <wsa:replyto>       <wsa:address>not needed sync request</wsa:address>    </wsa:replyto>    <wsa:to>https://ota2-p1.ihotelier.com/ota_seamless/services/dailyrateservice</wsa:to>    <wsa:action>dailyrate</wsa:action>    <wsa:from>       <saleschannelinfo id="xxxxxxxxx"/><!-- fields provided tc -->    </wsa:from>    <wsse:security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">       <wsu:timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">          <wsu:created>2016-02-05t15:55:56+00:00</wsu:created>          <wsu:expires>2016-02-06t15:56:06+00:00</wsu:expires>       </wsu:timestamp>       <wsse:usernametoken>          <wsse:username>xxxxx</wsse:username><!-- fields provided tc -->          <wsse:password>xxxxxx</wsse:password><!-- fields provided tc -->       </wsse:usernametoken>    </wsse:security> </soap:header>  <soap:body> <ota_hotelavailrq version="2.0" availratesonly="false" timestamp="2016-02-05t15:55:56+00:00">    <pos>       <source>          <requestorid type="1" id="" messagepassword=""/><!-- fields provided tc -->          <bookingchannel type="18">             <companyname companyshortname="" code=""/><!-- fields provided tc -->          </bookingchannel>       </source>    </pos>    <availrequestsegments>       <availrequestsegment responsetype="dailyratelist"><!-- request type -->          <hotelsearchcriteria availableonlyindicator="false">             <criterion>                <hotelref hotelcode="97593"/><!-- ihotelierid -->                <staydaterange start="2016-02-08" end="2016-02-15"/>                <roomstaycandidates>                   <roomstaycandidate quantity="1">                      <guestcounts>                         <guestcount agequalifyingcode="10" count="1"/><!-- adult -->                         <guestcount agequalifyingcode="8" count="0"/><!-- child -->                         <guestcount agequalifyingcode="7" count="0"/><!-- infant -->                      </guestcounts>                   </roomstaycandidate>                </roomstaycandidates>             </criterion>          </hotelsearchcriteria>       </availrequestsegment>    </availrequestsegments> </ota_hotelavailrq> </soap:body></soap:envelope> eot;     $body = new soapvar($xml,xsd_anyxml);  #- calling service method    $result = $client->servicerequest($body);   #- showing request , response    echo '<pre>', htmlentities($client->__getlastrequest()), '</pre>';    echo "<br> --------response---------<br>";    echo '<pre>', htmlentities($client->__getlastresponse()), '</pre>'; 

and i'm getting error

fatal error: uncaught soapfault exception: [soapenv:client.2000] mandatory values missing in message header... 

followed this tutorial. i'm doing wrong?

if method wrong, how create soap header , body above xml request?

this question difficult answer because lacks necessary documentation , parameters test example. appears paid commercial service requires account.

so perhaps best can demonstrate how use more simple service same site. 1 not require parameters , returns version shown below.

a list of other services available here.

<?php      try {         $client = new soapclient('https://ota2-p1.ihotelier.com/ota_seamless/services/version?wsdl');         $result = $client->getversion( );         print_r($result);    }    catch(exception $e) {        echo "\nexception:" .$e->getmessage();    } ?>  

web service returns:

apache axis version: 1.4 built on apr 22, 2006 (06:55:48 pdt)  

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -