title: Internal Error when executing a JSON request
body: <p>I'm developing an application which communicate with a server through JSON messages.</p>
  
  <p>Some messages was send and received the result properly. But one of my routines thrown an Error and I'm not sure if it is my problem or from the server.</p>
  
  <p>The error is:</p>
  
  <pre><code> org.apache.http.client.HttpResponseException: Internal Server Error
       at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:71)
       at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:59)
       at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657)
       at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:627)
       at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:616)
       at br.com.iba.dao.DLS.post(DLS.java:121)
       at br.com.iba.dao.DLS.fulfill(DLS.java:151)
       at br.com.iba.LibraryActivity$3.doAction(LibraryActivity.java:123)
       at br.com.iba.LibraryActivity$SwitchListener.setSelected(LibraryActivity.java:208)
       at br.com.iba.LibraryActivity$SwitchListener.access$0(LibraryActivity.java:204)
       at br.com.iba.LibraryActivity$ButtonGroup.onClick(LibraryActivity.java:230)
       at android.view.View.performClick(View.java:2408)
       at android.view.View$PerformClick.run(View.java:8816)
       at android.os.Handler.handleCallback(Handler.java:587)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at android.os.Looper.loop(Looper.java:123)
       at android.app.ActivityThread.main(ActivityThread.java:4627)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:521)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
       at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>My code to post is this:</p>
  
  <pre><code>    private String post(String json) {
          int TIMEOUT_MILLISEC = 10000; // = 10 seconds
          HttpParams httpParams = new BasicHttpParams();
          HttpConnectionParams.setConnectionTimeout(httpParams, TIMEOUT_MILLISEC);
          HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT_MILLISEC);
          HttpClient client = new DefaultHttpClient(httpParams);
  
          HttpPost request = new HttpPost(
                  "https://my server url");
          try {
              StringEntity entity = new StringEntity(json);
              entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE,
                      "application/json"));
              request.setEntity(entity);
  
              ResponseHandler&lt;String&gt; handler = new BasicResponseHandler();
              return client.execute(request, handler);
          } catch (Throwable e) {
              e.printStackTrace();
              return "";
          }
      }
  </code></pre>
  
  <p>I read on BasicResponseHandler Doc:</p>
  
  <p>"A ResponseHandler that returns the response body as a String for successful (2xx) responses. If the response code was >= 300, the response body is consumed and an HttpResponseException is thrown. If this is used with {@link org.apache.http.client.HttpClient#execute( org.apache.http.client.methods.HttpUriRequest, ResponseHandler), HttpClient may handle redirects (3xx responses) internally."</p>
  
  <p>So now I believe it was an server side error. I need to know which exactly error is that.</p>
  
  <p>Thanks</p>