Android では、httppost メソッドを使用してデータを webservice に投稿すると、webservice から応答が返されます。しかし、私は次のように応答します
Bad Request (無効なヘッダー名)
.応答本文で、このエラーが発生しています。
HttpClient httpClient = new DefaultHttpClient();
// HttpConnectionParams.setConnectionTimeout(httpClient.getParams(),
// 10000);
HttpPost httpPost = new HttpPost(url1);
Log.e("HTTPPOST", httpPost.toString());
httpPost.setHeader("content-type",
"application/json; charset= utf-8");
httpPost.setHeader("Accept", "application/json");
// Log.e("HTTPPOST", httpPost.toString());
JSONObject data = new JSONObject();
try {
data.put("URL", str);
StringEntity entity = new StringEntity(data
.toString(), HTTP.UTF_8);
entity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
httpPost.setEntity(entity);
try {
HttpResponse response = httpClient
.execute(httpPost);
// Log.e("dsfsdfsadf",response);
String responseBody = EntityUtils
.toString(response.getEntity());
Log.i("Server Response 1: ", responseBody);