私はAndroidアプリケーションを書いています。HTTPPost をサーバーに送信し、次を使用すると回答を受け取ります。
public final HttpResponse execute (HttpUriRequest request)
大丈夫です、
しかし、私が使用しようとすると:
public T execute (HttpUriRequest request, ResponseHandler<? extends T> responseHandler)
それは投げますClientProtocolException
何らかの理由で 2 番目の関数を使用したいのですが、どうすればよいですか? の例外は何ですか?
最初の関数を使用するコードは次のとおりです。
HttpPost httppost = new HttpPost("http://foo.Com/GeneralControls/Service.asmx/Login");
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httppost) ;
2 番目の関数を使用するコードは次のとおりです。
HttpPost httppost = new HttpPost("http://foo.Com/GeneralControls/Service.asmx/Login");
DefaultHttpClient httpclient = new DefaultHttpClient();
ResponseHandler<String> responseHandler=new BasicResponseHandler();
String response = httpclient.execute(httppost , responseHandler) ;
ClientProtocolException をスローします。