title: Issue when getting response from Apache HttpClient
body: <p>I'm trying to work with the response body of a <code>HTTP</code> <code>POST</code> action. I'm implementing the following method:</p>
  
  <pre><code>public class post2 {
  
      public final static void main(String[] args) throws Exception {
  
          CloseableHttpClient httpclient = HttpClients.createDefault();
  
          List&lt;NameValuePair&gt; formparams = new ArrayList &lt;NameValuePair&gt;();
          formparams.add(new BasicNameValuePair("login_id", myID));
          formparams.add(new BasicNameValuePair("api_key", myKey));
          UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, Consts.UTF_8);
          HttpPost httppost = new HttpPost(myURL);
          httppost.setEntity(entity);
  
          CloseableHttpResponse response2 = httpclient.execute(httppost);
  
          try {
  
              System.out.println(response2.getStatusLine());
              HttpEntity entity2 = response2.getEntity();
              EntityUtils.consume(entity2);
  
              String responseBody = EntityUtils.toString(entity2);
              System.out.println("finalResult"+responseBody.toString());              
          }
  
          finally {
               httpclient.close();
          }
      }
  }
  </code></pre>
  
  <p>I'm just receiving a "HTTP/1.1 200 OK", followed by: </p>
  
  <pre><code>Exception in thread "main" java.lang.ClassCastException: org.apache.http.impl.execchain.HttpResponseProxy cannot be cast to org.apache.http.HttpEntity
  at post2.main(post2.java:62)
  </code></pre>
  
  <p>How should I recover the body information from the WebService?</p>
  
  <p>Thanks,
  Leo</p>