title: JSON response Error Code 201,but it should be 200 in Android HTTP POST
body: <p>As iam trying to post the result of rating activity. After reading the rating value from the user I am calling the webservice thro HTTP POST and setting JSON object in it. As My webserver needs authentication, iam able to verify that as well.</p>
  
  <p>But real problem is the response code should be 200 but iam receiving 201. Please suggest me where iam going wrong! </p>
  
  <p>Code:</p>
  
  <pre><code>        public static String sendJson(final int rating, final String url) {
      Thread t = new Thread() {
          public void run() {
              Looper.prepare(); // For Preparing Message Pool for the child
               HttpResponse response;
  
              // proxy
              final String PROXY = "xxx.xxx.xxx.xxx";
              // proxy host
              final HttpHost PROXY_HOST = new HttpHost(PROXY, 8080);
              HttpParams httpParameters = new BasicHttpParams();
              mHttpClient = new DefaultHttpClient(httpParameters);
              HttpConnectionParams.setConnectionTimeout(mHttpClient.getParams(),
                   10000); //Timeout Limit
              mHttpClient.getParams().setParameter(
                      ConnRoutePNames.DEFAULT_PROXY, PROXY_HOST);
              System.out.println("Sending proxy request: " + mHttpClient);
              // mHttpClient = new DefaultHttpClient();
  
              JSONObject json = new JSONObject();
              try {
                  String reqUrl = new String(aBaseUrl + url);                  
                  HttpPost post = new HttpPost(reqUrl);
                  post.getParams().setParameter(
                          ConnRoutePNames.DEFAULT_PROXY, PROXY_HOST);
                  post.addHeader(BasicScheme
                          .authenticate(new UsernamePasswordCredentials(
                                  userName, password), "UTF-8", false));
                  System.out.println("Sending Post proxy request: " + post);
                  json.put("rating", rating);
  
                  // json.put("password", pwd);
                  // StringEntity se = new StringEntity( "JSON: " +json.toString());
  
                  StringEntity se = new StringEntity(json.toString());
                  System.out.println("JSON VALUE 2222 " + json.toString());
                  se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"application/json"));
                  // post.setEntity(new
                  // ByteArrayEntity(json.toString().getBytes("UTF8")));
  
                  post.setEntity(se);
                  response = mHttpClient.execute(post);
                  /* Checking response */
  
                  statusCode = response.getStatusLine().getStatusCode();
                  System.out.println("Http Execute finish " + statusCode);
  
                  if(statusCode==200)
                  {
                      HttpEntity entity = response.getEntity();
                      String getResponseText = EntityUtils.toString(entity);
                      System.out.println(" Post Response Text from Server : "
                              + getResponseText);
  
  
                  }
  
                  if (response != null) {
                      // InputStream in = response.getEntity().getContent();
                      // //Get the data in the entity
                      // HttpEntity entity = response.getEntity();
                      // String getResponseText =
                      // EntityUtils.toString(entity);
                      // System.out.println(" Post Response Text from Server : "
                      // + getResponseText);
  
                  }
              } catch (Exception e) {
                  e.printStackTrace();
                  // createDialog("Error", "Cannot Estabilish Connection");
              }
              Looper.loop(); // Loop in the message queue
          }
      };
      t.start();
      return url;
  }
  </code></pre>