Hay, I'm taying to make a simple Rest web service in C# and client on android. I find a simple C# web service, which add two number, on this link:
Can anyone help me to make Android client for this web service
Thanks
Hay, I'm taying to make a simple Rest web service in C# and client on android. I find a simple C# web service, which add two number, on this link:
Can anyone help me to make Android client for this web service
Thanks
See my question here: http://stackoverflow.com/questions/992880/unresolved-host-exception-android
Calling the rest service is just a matter of creating the HttpResponse and processing the returned xml/json/value.
Hi milos, i also want the REST service client in androids culd u plz help me out?
Best Regards, Faheem [email protected]
Hi, you probably found something that works, but i stumbled accross this thread, and for others, following can be useful.
I prefer REST application using with MVC and Android. -www.asp.net/mvc (good video-tutorials)
To create a Server:
h t t p : / / omaralzabir.com/create_rest_api_using_asp_net_mvc_that_speaks_both_json_and_plain_xml/
public class TestingController : Controller {
/// <summary>
/// Test
/// </summary>
/// <returns></returns>
public ActionResult GetString() {
return Content("A Result <orasxml id='testid'/>");
}
}
And set Global.asax:
//Test routes.MapRoute("test", "{Page}.Mvc/tester", new { controller = "Testing", action = "GetString", Page = defaultPage });
Andoid Client development code exampels:
h t t p : / /senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple-restful-client-at-android/
public String GetData(){
//Note, do not use http:// in host name. I did not get localhost-adress working, but
//hosted a page in IIS instead, and it worked.
HttpHost target = new HttpHost("www.example,com",80);
HttpGet get = new HttpGet("/tester");
String result=null;
HttpEntity entity = null;
HttpClient client = new DefaultHttpClient();
try {
HttpResponse response=client.execute(target, get);
entity = response.getEntity();
result = EntityUtils.toString(entity);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (entity!=null)
try {
entity.consumeContent();
} catch (IOException e) {}
}
return result;
}
//Display on buttontext, must create buttoon with ButtonReload as id...
final Button btn = (Button) findViewById(R.id.ButtonReload);
btn.setText(testString);
Tips about designing REST for Android:
h t t p : / /www.youtube.com/watch?v=xHXn3Kg2IQE
h t t p : / /www.infoq.com/articles/rest-introduction
General Android help:
h t t p : / /mobile.tutsplus.com/tutorials/android/introduction-to-android-development/
h t t p : / /www.youtube.com/watch?v=lqopIf-bA54&feature=related