The best way to consume API


Hits: 4651  
 
SOAP UI
 
<?php

require_once('lib/nusoap.php');

$url = "http://www.hotelscombined.com/api/wsdl/SearchSoap.wsdl"; // web service URL 

$client = new nusoap_client($url, false); // soap client to consume API

// XML payload from "soapUI" to send over wsdl server
$xmlRequest='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:hot="http://schemas.datacontract.org/2004/07/HotelsCombined.WebServices.Version4">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:HotelSearch>
         <!--Optional:-->
         <tem:request>
            <hot:ApiKey>?</hot:ApiKey>
            <hot:Checkin>?</hot:Checkin>
            <hot:Checkout>?</hot:Checkout>
            <hot:DisplayCurrency>?</hot:DisplayCurrency>
            <hot:Guests>?</hot:Guests>
            <hot:HotelID>?</hot:HotelID>
            <hot:LanguageCode>?</hot:LanguageCode>
            <hot:Rooms>?</hot:Rooms>
            <hot:TimeOutInSeconds>?</hot:TimeOutInSeconds>
            <hot:UserAgent>?</hot:UserAgent>
            <hot:UserID>?</hot:UserID>
            <hot:UserIPAddress>?</hot:UserIPAddress>
         </tem:request>
      </tem:HotelSearch>
   </soapenv:Body>
</soapenv:Envelope>';

$return = $client->send($xmlRequest, $url);  // send xml to service url

print_r($return);  // excepted output 😉

?>

Don’t find fault. Find a remedy.

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch