當我使用Firefox的「REST客戶端」或谷歌瀏覽器的「簡單REST客戶端」測試它時,我的API似乎正在工作完美。但是,當我使用Android SDK發送Http請求時,以下情況除外:Android Http請求ClientProtocolException
ClientProtocolException:服務器無法以有效的HTTP響應
還當我測試使用谷歌Chrome瀏覽器的「高級REST客戶端」迴應我有一個空的響應,所以什麼可能會導致此任何想法?
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpResponse httpResponse = null;
HttpPost httpPost = new HttpPost(Constants.URL);
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Accept", "application/json");
StringEntity se = new StringEntity(params,HTTP.UTF_8);
httpPost.setEntity(se);
httpClient.execute(httpPost);
任何運氣?我有類似的問題 – amadib