Reputation:
how to extract WCF REST services server response by POST method in android client. I have done encryption on string , then send it to server, facing problem..
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);
Upvotes: 0
Views: 788
Reputation: 9520
Below is code to get the exact response.
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();
}
Upvotes: 1
Reputation:
HttpResponse response = client.execute(post);
String Res = response.getEntity().toString();
Log.i("GetEntity",Res);
but only element getting... require expert help.
Upvotes: 0