PHP

Implementation using Soap Client


$xml = new DOMDocument( "1.0", "UTF-8" );

$xml_env = $xml->createElement( "soap:Envelope" );
$xml_env->setAttribute( "xmlns:soap", "http://www.w3.org/2003/05/soap-envelope" );
$xml_env->setAttribute( "xmlns:hot", "http://TekTravel/HotelBookingApi" );

/*create header*/
$xml_hed = $xml->createElement( "soap:Header" );
$xml_hed->setAttribute( "xmlns:wsa", "http://www.w3.org/2005/08/addressing" );

$xml_cred = $xml->createElement( "hot:Credentials" );
$xml_cred->setAttribute( "UserName", "kuldeepapi" );
$xml_cred->setAttribute( "Password", "12345" );

$xml_wsaa = $xml->createElement( "wsa:Action","http://TekTravel/HotelBookingApi/HotelSearch" );
$xml_wsat = $xml->createElement( "wsa:To","http://api.tbotechnology.in/hotelapi_v7/hotelservice.svc" );

$xml_hed->appendChild($xml_cred);
$xml_hed->appendChild($xml_wsaa);
$xml_hed->appendChild($xml_wsat);

$xml_env->appendChild($xml_hed);

/*create body*/
$xml_bdy = $xml->createElement( "soap:Body" );
$xml_bdyreq = $xml->createElement( "hot:HotelSearchRequest" );
$xml_bdyreqele = $xml->createElement( "hot:CheckInDate","2014-07-25" );
$xml_bdyreq->appendChild($xml_bdyreqele);

$xml_bdyreqele = $xml->createElement( "hot:CheckOutDate","2014-07-26" );
$xml_bdyreq->appendChild($xml_bdyreqele);

$xml_bdyreqele = $xml->createElement( "hot:CountryName","United Arab Emirates" );
$xml_bdyreq->appendChild($xml_bdyreqele);

$xml_bdyreqele = $xml->createElement( "hot:CityName","Dubai" );
$xml_bdyreq->appendChild($xml_bdyreqele);

$xml_bdyreqele = $xml->createElement( "hot:CityId","25921" );
$xml_bdyreq->appendChild($xml_bdyreqele);

$xml_bdyreqele = $xml->createElement( "hot:NoOfRooms","1" );
$xml_bdyreq->appendChild($xml_bdyreqele);

$xml_bdyreqele = $xml->createElement( "hot:GuestNationality","AE" );
$xml_bdyreq->appendChild($xml_bdyreqele);

$xml_bdyreqele = $xml->createElement( "hot:RoomGuests");
$xml_bdyreqinnerele = $xml->createElement( "hot:RoomGuest");
$xml_bdyreqinnerele->setAttribute("AdultCount","1");
$xml_bdyreqele->appendChild($xml_bdyreqinnerele);
$xml_bdyreq->appendChild($xml_bdyreqele);

$xml_bdyreqele = $xml->createElement( "hot:Filters");
$xml_bdyreqinnerele = $xml->createElement( "hot:StarRating","All");
$xml_bdyreqele->appendChild($xml_bdyreqinnerele);
$xml_bdyreq->appendChild($xml_bdyreqele);

$xml_bdy->appendChild($xml_bdyreq);
$xml_env->appendChild($xml_bdy);

$xml->appendChild($xml_env);
$request = $xml->saveXML();
   
$location = "http://api.tbotechnology.in/hotelapi_v7/hotelservice.svc";
$action = "http://TekTravel/HotelBookingApi/HotelSearch";
$client = new SoapClient("http://api.tbotechnology.in/hotelapi_v7/hotelservice.svc?wsdl");
$resp = $client->__doRequest($request , $location , $action , 2 );
print_r($resp);

3.2 Destination City List
$xml = new DOMDocument( "1.0", "UTF-8" );

$xml_env = $xml->createElement( "soap:Envelope" );
$xml_env->setAttribute( "xmlns:soap", "http://www.w3.org/2003/05/soap-envelope" );
$xml_env->setAttribute( "xmlns:hot", "http://TekTravel/HotelBookingApi" );

/*create header*/
$xml_hed = $xml->createElement( "soap:Header" );
$xml_hed->setAttribute( "xmlns:wsa", "http://www.w3.org/2005/08/addressing" );

$xml_cred = $xml->createElement( "hot:Credentials" );
$xml_cred->setAttribute( "UserName", "kuldeepapi" );
$xml_cred->setAttribute( "Password", "12345" );

$xml_wsaa = $xml->createElement( "wsa:Action","http://TekTravel/HotelBookingApi/DestinationCityList" );
$xml_wsat = $xml->createElement( "wsa:To","http://api.tbotechnology.in/hotelapi_v7/hotelservice.svc" );

$xml_hed->appendChild($xml_cred);
$xml_hed->appendChild($xml_wsaa);
$xml_hed->appendChild($xml_wsat);

$xml_env->appendChild($xml_hed);

/*create body*/
$xml_bdy = $xml->createElement( "soap:Body" );
$xml_bdyreq = $xml->createElement( "hot:DestinationCityListRequest" );
$xml_bdyreqele = $xml->createElement( "hot:CountryCode","AE" );

$xml_bdyreq->appendChild($xml_bdyreqele);
$xml_bdy->appendChild($xml_bdyreq);
$xml_env->appendChild($xml_bdy);

$xml->appendChild($xml_env);
$request = $xml->saveXML();

$location = "http://api.tbotechnology.in/hotelapi_v7/hotelservice.svc";
$action = "http://TekTravel/HotelBookingApi/DestinationCityList";
$client = new SoapClient("http://api.tbotechnology.in/hotelapi_v7/hotelservice.svc?wsdl");
$resp = $client->__doRequest($request , $location , $action , 2 );
print_r($resp);