Hi Guys,
URL: http://some path/userLogin.html?json=[{"emailid":"vijayajay17@gmail.com","password":"vijay17"}]
o/p: {"login":{"loginmsg":"successful","userid":"20","user_type":"Voter"}}
If I will Run this URL is web browser I should get the above o/p in json format.
in code:
JSONObject j = new JSONObject();
j.put("emailid", "vijayajay17@gmail.com");
j.put("password", "vijay17");
String url = "http://some path/userLogin.html";
HttpClient httpclient = new DefaultHttpClient();
HttpPost request = new HttpPost(url);
StringEntity stringEntity = new StringEntity(j.toString());
stringEntity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
HttpEntity httpEntity = stringEntity;
request.setEntity(httpEntity);
HttpResponse response = httpclient.execute(request);
String temp = EntityUtils.toString(response.getEntity());
System.out.println(temp);
My O/P: {"login":{"loginmsg":"account not activated"}}
Can Any one help me in this?
Where I am doing mistake?
Thanks in Advance.
.
No comments:
Post a Comment