Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot get httpResponse content
    primarykey
    data
    text
    <p>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 returned in the HttpResponse's Entity (length is -1).</p> <pre><code>String url = serverUrl + resource; Log.d(TAG, "GET: " + url); HttpClient client = new DefaultHttpClient(); HttpGet getMethod = new HttpGet((url)); getMethod.setHeader("User-Agent", USER_AGENT); getMethod.addHeader("Authorization", "Basic " + getCredentials()); HttpResponse httpResponse = client.execute(getMethod); Log.e(TAG, "RESPONSE:" + httpResponse); Log.i(TAG,httpResponse.getStatusLine().toString()); Log.i(TAG + "1",httpResponse.getLocale().toString()); Log.i(TAG + "2",httpResponse.getHeaders(USER_AGENT).toString()); Log.i(TAG + "3",httpResponse.getEntity().toString()); Log.i(TAG + "4",httpResponse.getEntity().getContent().toString()); int length = (int) httpResponse.getEntity().getContentLength(); Log.e(TAG + "5", "LENGTH:" + length); </code></pre> <p>The logs:</p> <pre><code>D/HttpServices( 275): GET: http://www.google.com/search?q=android D/dalvikvm( 275): GC freed 2992 objects / 217016 bytes in 103ms E/HttpServices( 275): RESPONSE:org.apache.http.message.BasicHttpResponse@43ca4920 I/HttpServices( 275): HTTP/1.1 200 OK I/HttpServices1( 275): en_US I/HttpServices2( 275): [Lorg.apache.http.Header;@43c44e10 I/HttpServices3( 275): org.apache.http.conn.BasicManagedEntity@43c40be8 I/HttpServices4( 275): org.apache.http.conn.EofSensorInputStream@43c51c60 E/HttpServices5( 275): LENGTH:-1 </code></pre> <p>I'm not behind a proxy and have added the INTERNET permission in the manifest. What can be the reason for not retrieving the content of the get query (<a href="http://www.google.com/search?q=android" rel="nofollow noreferrer">http://www.google.com/search?q=android</a>). Thanks a lot for your help, Luc</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload