LearneR ツ February 2016

Create raw XML request using PHP SoapClient

I am trying to create raw XML request with SoapVar. Here is my code

#- Loading the WSDL document
  $wsdl = "https://ota2-p1.ihotelier.com/OTA_Seamless/services/DailyRateService?wsdl";
  $client = new SoapClient($wsdl,array('trace' => true, 'exceptions' => true));

#- Creating the 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 FOR 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 to be provided by 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 to be provided by TC -->
         <wsse:Password>XXXXXX</wsse:Password><!-- Fields to be provided by 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=        

Answers


Roberto February 2016

This question is difficult to answer because it lacks necessary documentation and parameters to test an example. It also appears to be a paid commercial service that requires an account.

So perhaps the best we can do is demonstrate how to use a much more simple service from the same site. This one does not require any parameters and returns the version as shown below.

A list of other services is 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) 

Post Status

Asked in February 2016
Viewed 3,130 times
Voted 6
Answered 1 times

Search




Leave an answer