Unresolved Host Exception Android
Posted
by Rob Stevenson-Leggett
on Stack Overflow
See other posts from Stack Overflow
or by Rob Stevenson-Leggett
Published on 2009-06-14T14:06:10Z
Indexed on
2010/04/27
6:03 UTC
Read the original article
Hit count: 674
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?
© Stack Overflow or respective owner