0

我想用这种格式发出http post请求

{
  "Request":{
     "Data":{
      "RMID":"0910403545",
      "QID":"151",
      "RC":"5010",
      "Alg":"IMEI",
      "AlgID":"987654321",
      "IPD":"1223331",
      "Now":"27-01-2013"
  },
     "Signature":"5a185c480d11ebd39675977e40af34fe4a0121aa"
  }
}

我已经在我的android应用程序中尝试过,这里的代码..

AsyncHttpClient client = new AsyncHttpClient();
RequestParams params = new RequestParams();
JSONObject object = new JSONObject();
object.put("RMID", "0910403545");
object.put("QID", "151");
object.put("RC", "5010");
object.put("Alg", "IMEI");
object.put("AlgID", "987654321");
object.put("IPD", "1223331");
object.put("Now", "27-01-2013");
params.put("Data", object.toString());
params.put("Signature", "5a185c480d11ebd39675977e40af34fe4a0121aa");
client.post(link, params, new AsyncHttpResponseHandler(){
    @Override
    public void onSuccess(String response) {
    // TODO Auto-generated method stub
        Log.d("XXX", response);
    }

    @Override
    public void onFailure(Throwable error, String response) {
        // TODO Auto-generated method stub
        Log.d("XXX", response);
    }
});

反应不是我所期望的。如果我尝试使用 javascript,情况会有所不同。

4

0 回答 0