No exception, no error, still i dont recieve the json object from my http post
- by user2978538
My source code:
final Thread t = new Thread() {
public void run() {
Looper.prepare();
HttpClient client = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000);
HttpResponse response;
JSONObject obj = new JSONObject();
try {
HttpPost post = new HttpPost("http://pc.dyndns-office.com/mobile.asp");
obj.put("Model", ReadIn1);
obj.put("Product", ReadIn2);
obj.put("Manufacturer", ReadIn3);
obj.put("RELEASE", ReadIn4);
obj.put("SERIAL", ReadIn5);
obj.put("ID", ReadIn6);
obj.put("ANDROID_ID", ReadIn7);
obj.put("Language", ReadIn8);
obj.put("BOARD", ReadIn9);
obj.put("BOOTLOADER", ReadIn10);
obj.put("BRAND", ReadIn11);
obj.put("CPU_API", ReadIn12);
obj.put("DISPLAY", ReadIn13);
obj.put("FINGERPRINT", ReadIn14);
obj.put("HARDWARE", ReadIn15);
obj.put("UUID", ReadIn16);
StringEntity se = new StringEntity(obj.toString());
se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
post.setEntity(se);
post.setHeader("host", "http://pc.dyndns-office.com/mobile.asp");
response = client.execute(post);
if (response != null) {
InputStream in = response.getEntity().getContent();
}
} catch (Exception e) {
e.printStackTrace();
}
Looper.loop();
}
};
t.start();
}
}
i want to send an Json object to a Website. As far as I can see, I set the header, but still I get this exception, can someone help me?
(I'm using Android-Studio)
__
Edit: i don't get any exceptions anymore, but still i do not receive the json packet.
When i manually call the website i get a log file entry.
Does anyone know, what's wrong?
Edit2:
When i debug i get as response "HTTP/1.1 400 bad request" i'm sure its not an permission problem. Any ideas?