Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 31, 2012 02:53 PM by abamboria
Member
145 Points
88 Posts
Dec 31, 2012 12:35 PM|LINK
Hello,
When I run my code, I never get xml. I am not able to find what probelm with my code. I mentioned my code below. Please help me in this regard. I never got an exception also.
try { //string city = dl_city.SelectedValue; string room = Dl_room.SelectedValue; string startdate = txtFrom.Text; string enddate = txtTo.Text; int room1 = Convert.ToInt16(room); DateTime fromdate = Convert.ToDateTime(startdate); DateTime todate = Convert.ToDateTime(enddate); string service = "http://api.ean.com/ean-services/rs/hotel/"; string version = "v3/"; string method = "list/"; // string hotelId = "201252"; string otherElemntsStr = "&cid=411931&minorRev=[12]&customerUserAgent=[hotel]¤cyCode=INR"; string apiKey = "tzyw4x2zspckjayrbjekb397"; string secret = "XCzhymKa "; string url = service + version + method + "?apiKey=" + apiKey + "&secret=" + secret + otherElemntsStr; // + "&hotelIdList=" + hotelId var poststring = string.Format("room1={0}&fromdate={1}&todate={2}", room1, fromdate, todate); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url) as HttpWebRequest; request.Method = "POST"; StreamWriter requestWriter = new StreamWriter(request.GetRequestStream()); requestWriter.Write(poststring); requestWriter.Close(); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader responsereader = new StreamReader(response.GetResponseStream()); string responsedata = responsereader.ReadToEnd(); responsereader.Close(); request.GetResponse().Close(); } catch (Exception ex) { throw ex; } }
Dec 31, 2012 02:53 PM|LINK
I debug my code step by step. I found, this probelm with my code. I mentioned exception below.
this is invalid argument Exception. can anyone give me solution of this probelm. I tried but I never found which argument give probelm.
base {System.InvalidOperationException} = System.InvalidOperationException
abamboria
Member
145 Points
88 Posts
Probelm with WebApi!!!!!
Dec 31, 2012 12:35 PM|LINK
Hello,
When I run my code, I never get xml. I am not able to find what probelm with my code. I mentioned my code below. Please help me in this regard. I never got an exception also.
try { //string city = dl_city.SelectedValue; string room = Dl_room.SelectedValue; string startdate = txtFrom.Text; string enddate = txtTo.Text; int room1 = Convert.ToInt16(room); DateTime fromdate = Convert.ToDateTime(startdate); DateTime todate = Convert.ToDateTime(enddate); string service = "http://api.ean.com/ean-services/rs/hotel/"; string version = "v3/"; string method = "list/"; // string hotelId = "201252"; string otherElemntsStr = "&cid=411931&minorRev=[12]&customerUserAgent=[hotel]¤cyCode=INR"; string apiKey = "tzyw4x2zspckjayrbjekb397"; string secret = "XCzhymKa "; string url = service + version + method + "?apiKey=" + apiKey + "&secret=" + secret + otherElemntsStr; // + "&hotelIdList=" + hotelId var poststring = string.Format("room1={0}&fromdate={1}&todate={2}", room1, fromdate, todate); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url) as HttpWebRequest; request.Method = "POST"; StreamWriter requestWriter = new StreamWriter(request.GetRequestStream()); requestWriter.Write(poststring); requestWriter.Close(); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader responsereader = new StreamReader(response.GetResponseStream()); string responsedata = responsereader.ReadToEnd(); responsereader.Close(); request.GetResponse().Close(); } catch (Exception ex) { throw ex; } }Mark as Answer:- if the post helped you...
abamboria
Member
145 Points
88 Posts
Re: Probelm with WebApi!!!!!
Dec 31, 2012 02:53 PM|LINK
Hello,
I debug my code step by step. I found, this probelm with my code. I mentioned exception below.
this is invalid argument Exception. can anyone give me solution of this probelm. I tried but I never found which argument give probelm.
base {System.InvalidOperationException} = System.InvalidOperationException
Mark as Answer:- if the post helped you...