Calling Rest webservice in Android
<p>I have Java web application server [ acts like server ].</p>

<p>In Android application, using httppost i have calling the restwebserive server.</p>

<p>My calling is hit the webservice with the response code 200. </p>

<p>Now i want to pass the java class object as like parameter. </p>

<p>sample java class: </p>

<pre><code>public Class Sample{

public String Username;

public String getUsername()
{

return Username;

}

public void setUsername(String user){


this.Username = user;

}}
</code></pre>

<p>Used code :[ Is not passing my class object to server ]</p>

<pre><code>  Sample sam = new Sample();
  sam.setUsername("Test");
  JSONObject json = new JSONObject();  
  json.put("Sample", sam);            
  StringEntity se = new StringEntity(json.toString());  
  Httppostrequest.setEntity(se);
</code></pre>

<p>when i debugging the server the sample object parameter input is empty.[Not passed properly]<br>
How to pass the class object via http post in android?
Please help me on this.</p>

<p>Thanks in advance,</p>

<p>Kums</p>
