Home Ask Login Register

Developers Planet

Your answer is one click away!

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">
      <wsa:Address>NOT NEEDED FOR SYNC REQUEST</wsa:Address>
      <SalesChannelInfo ID="XXXXXXXXX"/><!-- Fields to be provided by TC -->
   <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">
         <wsse:Username>XXXXX</wsse:Username><!-- Fields to be provided by TC -->
         <wsse:Password>XXXXXX</wsse:Password><!-- Fields to be provided by TC -->

<OTA_HotelAvailRQ Version="2.0" AvailRatesOnly="False" TimeStamp="2016-02-05T15:55:56+00:00">
         <RequestorID Type="1" ID="" MessagePassword=        


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.

    try {
        $client = new SoapClient('https://ota2-p1.ihotelier.com/OTA_Seamless/services/Version?wsdl');
        $result = $client->getVersion( );
   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


Leave an answer

Quote of the day: live life