title: Send "PUT" request in Android to rest api
body: <p>I have an android application that consulting and insert in a web service rest-ful.
  all this through apache HTTPClient and JSON.</p>
  
  <p>so for example I insert a new user into db.</p>
  
  <pre><code>HttpClient httpclient = new DefaultHttpClient();
          // 2. make POST request to the given URL
              HttpPost httpPost = new HttpPost(url);
              String json = "";
              // 3. build jsonObject
              JSONObject jsonObject2 = new JSONObject();
              jsonObject2.put("name", name);
              jsonObject2.put("number", num);
           // 4. convert JSONObject to JSON to String
              json = jsonObject.toString();
          // 5. set json to StringEntity
              StringEntity se = new StringEntity(json);
          // 6. set httpPost Entity
              httpPost.setEntity(se);
          // 7. Set some headers to inform server about the type of the content   
              httpPost.setHeader("Accept", "application/json");
              httpPost.setHeader("Content-type", "application/json");
              // 8. Execute POST request to the given URL
              HttpResponse httpResponse = httpclient.execute(httpPost);
  </code></pre>
  
  <p>all perfectly created, well now I want to use the method that I created in the rest api, method PUT to overwrite for example the name of the user with ID 5 If I want to do a get enter my url + / ID and get a particular user. to "PUT" I do this but does not work.</p>
  
  <pre><code> @Override
      protected String doInBackground(String... params) {
          InputStream inputStream = null;
          String result = ""; 
  
          try {
              // 1. create HttpClient
              HttpClient httpclient = new DefaultHttpClient();
              // 2. make POST request to the given URL
  
              HttpPut httpPut = new    
              HttpPut("http://000.000.0.000:0000/xxxxxx/webresources/net.xxxxx.users/5");
              String json = "";
              //              // 3. build jsonObject
              //              JSONObject jsonObject2 = new JSONObject();
              //              jsonObject2.put("idGuarderias", idG);
              // 3. build jsonObject
              JSONObject jsonObject = new JSONObject();
              jsonObject.put("name",newName);
              //      jsonObject.put("guarderiasIdGuarderias",jsonObject2);
              json = jsonObject.toString();
              StringEntity se = new StringEntity(json);
              // 6. set httpPost Entity
              httpPut.setEntity(se);
              // 7. Set some headers to inform server about the type of the content   
              httpPut.addHeader("Accept", "application/json");
              httpPut.addHeader("Content-type", "application/json");
              // 8. Execute POST request to the given URL
              HttpResponse httpResponse = httpclient.execute(httpPut);
  
          } catch (Exception e) {
              Log.d("InputStream", e.getLocalizedMessage());
          }
  </code></pre>
  
  <p>What changes should I make?</p>