次のコードを使用してに接続しています.Net Web API
が、私の理解では、オブジェクトを使用しているPOST
ためメソッドを使用してHttpPost
いますが、API は次のように述べています。
The requested resource does not support http method 'GET'.
私のコード:
private boolean POST(List<NameValuePair>[] nvPair) {
HttpClient httpclient = new DefaultHttpClient();
String UrlString = URLEncodedUtils.format(nvPair[0], "utf-8");
HttpPost httppost = new HttpPost(apiBaseUri + UrlString);
try {
httppost.setEntity(new UrlEncodedFormEntity(nvPair[0]));
HttpResponse response = httpclient.execute(httppost);
String respond = response.getStatusLine().getReasonPhrase();
Log.d("MSG 3 > ", respond);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
return true;
}