I am using an api for getting the data but when i use the json i get the data with the following code
string apiKey = Connection.AppSettings("APIKey");
string fullURL = "http://api.hotelspro.com/4.1_test/hotel/b2bHotelJSON.php?method=getAvailableHotel&apiKey=" + apiKey + "&destinationId=LD6J&checkIn=2012-07-20&checkOut=2012-07-24¤cy=EUR&clientNationality=UK&onRequest=false&rooms[0][0][paxType]=Adult&rooms[0][1][paxType]=Adult&rooms[0][2][paxType]=Child&rooms[0][2][age]=6&rooms[1][0][paxType]=Adult&rooms[1][1][paxType]=Adult&rooms[1][2][paxType]=Child&rooms[1][2][age]=8&filters[0][filterType]=hotelStar&filters[0][filterValue]=3&filters[1][filterType]=resultLimit&filters[1][filterValue]=10";
string text;
try
{
HttpWebRequest request = WebRequest.Create(fullURL) as HttpWebRequest;
request.Method = "Get";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
if (response.StatusCode != HttpStatusCode.OK)
throw new Exception(String.Format(
"Server error (HTTP {0}: {1}).",
response.StatusCode,
response.StatusDescription));
using (var sr = new StreamReader(response.GetResponseStream()))
{
text = sr.ReadToEnd();
}
Response.Write(text);
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
But when i am using the same thing below this code with soap then its showing zero records.
here is the code for soap wsdl .
b2bHotelSOAPService objsoap = new b2bHotelSOAPService();
objsoap.Timeout = 20000;
objsoap.Url = "http://api.hotelspro.com/4.1_test/hotel/b2bHotelSOAP.php";
string destinationId = "CIEC";
DateTime checkIn = new DateTime(2012, 7, 20);
DateTime checkOut = new DateTime(2012, 7, 24);
string strCurrencyCode = "EUR";
pax[][] rooms = new pax[3][];
rooms[0] = new pax[3];
rooms[0][0] = new pax();
rooms[0][1] = new pax();
rooms[0][2] = new pax();
rooms[1] = new pax[3];
rooms[1][0] = new pax();
rooms[1][1] = new pax();
rooms[1][2] = new pax();
rooms[0][0].paxType = "Adult";
rooms[0][1].paxType = "Adult";
rooms[0][2].paxType = "Child";
rooms[0][2].age = "6";
rooms[1][0].paxType = "Adult";
rooms[1][1].paxType = "Adult";
rooms[1][2].paxType = "Child";
rooms[1][2].age = "8";
filter[] f = new filter[2];
f[0] = new filter();
f[0].filterType = "hotelStar";
f[0].filterValue = "3";
f[1] = new filter();
f[1].filterType = "resultLimit";
f[1].filterValue = "20";
getAvailableHotelResponse getres = new getAvailableHotelResponse();
getres = objsoap.getAvailableHotel(apiKey, destinationId, checkIn, checkOut, strCurrencyCode, "UK", false, rooms, f);
here gets show zero records.
Thanks to hotelsPro.com support team . Finally i got answer from them that i am making three rooms in this soap request but sending data only for two .
so i need to change this line
into
and now i am getting response from soap also. once again to thanks hotelsPro.com support team.