title: Can't post string to Rest API from Android [Java]
body: <p>I am programming simple app for android and i need to post data to my server. I always receive Http code 200 (success) but server data never receive.</p>
  
  <p>The server is running ASP.NET MVC 5 project. Here is source code of page which i am calling from android.:</p>
  
  <pre><code>public string Post([FromBody]string data) // webapi 2.0
      {
          if (data == null) return "error. you must send data";
  
          // my logic..
  
          return "OK";
      }
  </code></pre>
  
  <p>I always receive "error. you must send data" :(</p>
  
  <p>Here is source code of client side (Android app)</p>
  
  <pre><code>public static int RegisterNewUser(String nick, String pwd) {
      HttpClient httpClient = new DefaultHttpClient();
  
      try{
          HttpPost request = new HttpPost("http://helpforimigrants.somee.com/api/User");
  
          StringEntity params = new StringEntity("simple string. just plain text, simple sentence");
  
          request.addHeader("content-type", "application/x-www-form-urlencoded");
          request.setEntity(params);
          HttpResponse response = httpClient.execute(request);
          System.out.println(response.getStatusLine().getStatusCode());
  
      } catch(Exception e){
  
      } finally {
          httpClient.getConnectionManager().shutdown();
      }
      return 0;
  }
  </code></pre>
  
  <p>please help, i am programming beginner.</p>