hi
i am new in Rest Web service.
I am developing windows phone 8 application.
I have following things
server => 'http://webchannel.co/demo/einsurer/api/rtainsurer/'
http_user' =>xxxxxxxx
http_pass => xxxxxxx
api_key => xxxxxx
http_auth=> basic
test for method : xyzmethod
parameter: lang=>'en'
http_user' =>xxxxxxxx
http_pass => xxxxxxx
api_key => xxxxxx
http_auth=> basic
test for method : xyzmethod
parameter: lang=>'en'
now i want to call this web service using Webclient or Httpwebrequest
how call this using this two class.
i already try but it give result like "Remote server not found"
i also know how to check this type API in Soup UI
please help me through or any link as possible as.
thanks
Suresh MPosted May 7, 2015, 12:16 AM
WebClient request=new WebClient();
request.Headers[HttpRequestHeader.ContentType]="application/json";
var result=await request.UploadStringTaskAsync(requestUrl,requestmethod,JsonParameters);
Suresh MPosted May 19, 2015, 5:59 AM
Suresh MPosted May 8, 2015, 1:54 AM
mohsin shekhPosted May 8, 2015, 12:47 AM
Pranav ShahPosted Apr 30, 2015, 1:31 AM
your code not working. it's generate error like
"Remote sever not found" and how to set header of web service
like below
http_user' =>xxxxxxxx
http_pass => xxxxxxx
api_key => xxxxxx
http_auth=> basic
and where i set method name
method : xyzmethod
Prakash TripathiPosted Apr 29, 2015, 3:05 AM
Below links may help.
http://blogs.msdn.com/b/wsdevsol/archive/2014/01/09/consuming-rest-services-in-your-windows-store-and-phone-applications.aspx
http://www.asp.net/web-api/overview/mobile-clients/calling-web-api-from-a-windows-phone-8-application
Shailesh UkePosted Apr 29, 2015, 2:37 AM
WebClient client = new WebClient();
client.Headers["Accept"] = "application/json";
client.DownloadStringAsync(new Uri(uri));
client.DownloadStringCompleted += (s1, e1) =>
{
// string data = JsonConvert.DeserializeObject(e1.Result.ToString());
MessageBox.Show("A");
MessageBox.Show(e1.Result.ToString());
}