獲取例外DefaultHttpClient附近時,我試圖在java.Here訪問REST風格的WCF服務是我的代碼:獲取異常,當我試圖在java.Here訪問REST風格的WCF服務是我的代碼
public String rest(String SERVICE_URI){
String a="";
try{
HttpGet request = new HttpGet(SERVICE_URI + "/hello");
request.setHeader("Accept", "application/json");
request.setHeader("Content-type", "application/json");
**DefaultHttpClient httpClient = new DefaultHttpClient();**
HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
// Read response data into buffer
char[] buffer = new char[(int)responseEntity.getContentLength()];
InputStream stream = responseEntity.getContent();
InputStreamReader reader = new InputStreamReader(stream);
reader.read(buffer);
stream.close();
JSONArray plates = new JSONArray(new String(buffer));
a=plates.toString();
}catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return a;
}
的例外是:
Exception in thread "main" java.lang.VerifyError: (class:
組織/阿帕奇/ HTTP/IMPL /客戶端/ DefaultHttpClient, 方法:createHttpParams簽名: ()Lorg /阿帕奇/ HTTP/PARAMS/HttpP arams;) 不兼容的功能參數
請任何人都可以幫助我...謝謝。