Skip to content Skip to sidebar Skip to footer

Cannot Get Httpresponse Content

I didn'y manage to query a web service from android emulator (previously I had a UnresolvedHostException but this is ok). Now that I can go any further, I do not have anything retu

Solution 1:

Don't rely on the content length. Sometimes it is unable to find the content length so just retrieve the returned data

URL url = new URL("xyz.com";); 
URLConnection conn = url.openConnection();
conn.setRequestProperty("Authorization", "Basic"+getcredentials());
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
//read d response till d end
while ((line = rd.readLine()) != null) {//process the line response}

Post a Comment for "Cannot Get Httpresponse Content"