Can anyone show me an simple example about posting data with json format from android to asp mvc web server ? i used this for getting data from asp.net mvc to android with json format:
new Thread() {
public void run() {
try{
JsonNode userData = null;
ObjectMapper mapper = new ObjectMapper();
HttpResponse res;
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost post = new HttpPost(URI.create("http://mylink.com/test/api"));
res = httpclient.execute(post);
userData = mapper.readValue(res.getEntity().getContent(), JsonNode.class);
name= (String)userData.get("name").getTextValue();
}catch(Exception e){
Log.e("activity","dead",e);
}
}
}.start();
editStatus.setText(name);
and in asp.net :
[HttpPost]
public ActionResult Api()
{
return Json(new { name = "test" });
}
It's work perfectly for getting data from an asp.net mvc web server but how can i send data from android to asp.net mvc controller with json format or another format?