我需要通过android设备发送一个名为“json”的json变量到地址 http://otu-git.dyndns.ws/pvm_srv/serv.php我当前的代码是这样的:
JSONObject jsn = new JSONObject();
JSONObject json = new JSONObject();
JSONObject header = new JSONObject();
try {
header.put("txtUser", "123");
header.put("md5Passwd", "123");
header.put("fun", "validarUsuario");
jsn.put("USR", header);
json.put("json", jsn);
se = new StringEntity(json.toString());
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("json",json.toString()));
httppost.setEntity(new UrlEncodedFormEntity(params));
Log.i("dhiraj",params.toString());
////////////////////////////////////////////////////////////
HttpResponse response = httpclient.execute(httppost);
entity = response.getEntity();
但是我从服务器收到 Empty Json Post 响应!