I need to send http request with the following view:
POST /device/api/login HTTP/1.1
Content-Type: text/json
{"login":"LOGIN","password":"PASSWORD"}
[my code]
DefaultHttpClient hClient = new
DefaultHttpClient();
HttpPost post = new HttpPost(host +
"/device/api/login");
post.setHeader("Content-Type", "text/json");
JSONObject jo = new JSONObject();
jo.put("login", login);
jo.put("password", password);
String joSt = jo.toString();
BasicHttpEntity be = new BasicHttpEntity();
byte bytes[] = joSt.getBytes();
be.setContent(new ByteArrayInputStream(bytes));
post.setEntity(be);
HttpResponse response = hClient.execute(post);
hClient.getConnectionManager().shutdown();
[/my code]
It doesn't work. Could you help me to figure out what's wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---