如何在android客户端通过POST方法提取WCF REST服务服务器响应
如何在android客户端通过POST方法提取WCF REST服务服务器响应。我已经对字符串进行了加密,然后将其发送到服务器,面临问题如何在android客户端通过POST方法提取WCF REST服务服务器响应,android,wcf,Android,Wcf,如何在android客户端通过POST方法提取WCF REST服务服务器响应。我已经对字符串进行了加密,然后将其发送到服务器,面临问题 JSONObject jObject = new JSONObject(); try { HttpPost post = new HttpPost(url); jObject.put("jsonString", eJSON); jObject.
JSONObject jObject = new JSONObject();
try {
HttpPost post = new HttpPost(url);
jObject.put("jsonString", eJSON);
jObject.put("key", cryptKey);
Log.i("jason Object", jObject.toString());
post.setHeader("json", jObject.toString());
StringEntity se = new StringEntity(jObject.toString());
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,
"application/json"));
post.setEntity(se);
但唯一的元素是。。。需要专家帮助。下面是获得准确响应的代码
HttpEntity responseEntity = getResponse.getEntity();
Log.d(TAG, "response.getEntity() = " + getResponse.getEntity());
String HTTP_response = null;
try {
HTTP_response = EntityUtils.toString(responseEntity, HTTP.UTF_8);
Log.i(TAG, "Jsontext = " + HTTP_response);
} catch (ParseException e1) {
e1.printStackTrace();
}
HttpEntity responseEntity = getResponse.getEntity();
Log.d(TAG, "response.getEntity() = " + getResponse.getEntity());
String HTTP_response = null;
try {
HTTP_response = EntityUtils.toString(responseEntity, HTTP.UTF_8);
Log.i(TAG, "Jsontext = " + HTTP_response);
} catch (ParseException e1) {
e1.printStackTrace();
}