I'm trying to call a RESTful web service from an Android application using the following method:
HttpHost target = new HttpHost("http://" + ServiceWrapper.SERVER_HOST,ServiceWrapper.SERVER_PORT);
HttpGet get = new HttpGet("/list");
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;
I can browse to address and see the xml results using the Android Emulator browser and from my machine. I have given my app the INTERNET permission.
I'm developing with eclipse.
I've seen it mentioned that I might need to configure a proxy but since the web service i'm calling is on port 80 this shouldn't matter should it? I can call the method with the browser.
Any ideas?