am trying to get the XML file from a URL but am getting no Response and the code stops later because the String xml is null, can you tell me whats the problem ?
public String getXmlFromUrl(String url) {
String xml = null;
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
HttpResponse httpResponse = httpClient.execute(httpPost);
// I printed the response here but I got nothing !
HttpEntity httpEntity = httpResponse.getEntity();
xml = EntityUtils.toString(httpEntity);
return xml;
} catch (Exception e) {
e.printStackTrace();
}
Please be specific in you answers I appreciate your help
Why you are using HTTPPost?? You are not sending any data Even. Try with HttpGet.
Try This :