The method below falls over when reading the HttpResponse with the error: \"Content has been consumed\". I understand that the content can only be consumed once but I get t
I think your code is right. but try this to access string from HttpEntity: String response_str =EntityUtils.toString(responseEntity, HTTP.UTF_8);
like i used in my method:
public String SetObjectSecurity(String username, String password,
String clientName,String docRid,String ObjectRidsForCheckSum) throws JSONException, ClientProtocolException, IOException
{
String SetObjectSecurityURL = "url";
StringEntity str_request_entity = null;
HttpResponse http_response = null;
HttpGet getrequest = new HttpGet(SetObjectSecurityURL);
postrequest.setHeader("Accept", "application/json");
postrequest.setHeader("Content-type", "application/json");
//set param here
HttpClient httpClient = new DefaultHttpClient();
http_response = httpClient.execute(getrequest);
//Log.e("Status code ",http_response);
HttpEntity responseEntity = http_response.getEntity();
String response_str =EntityUtils.toString(responseEntity, HTTP.UTF_8);
Log.e("output",response_str);
int i = http_response.getStatusLine().getStatusCode();
Log.e("status","code "+i);
if(i==this){
do this}
else
{
this
}
return response_str;
}