0

我正在尝试通过 Http post 方法将一些值发布到服务器,但我总是收到此错误:

org.apache.http.client.HttpResponseException: Not Found 
Detail message - not found

我正在使用 KeyValue 对方法发送值,请帮助我,任何帮助将不胜感激。

代码 - HttpParams httpParams = new BasicHttpParams();

HttpConnectionParams.setConnectionTimeout(httpParams, 1000);
HttpConnectionParams.setSoTimeout(httpParams, 1000);
HttpParams p = new BasicHttpParams();
HttpClient httpclient = new DefaultHttpClient(p);
String url = "myurl";
HttpPost httppost = new HttpPost(url);
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
                        7);
nameValuePairs.add(new BasicNameValuePair("username",
                        "test"));
nameValuePairs.add(new BasicNameValuePair("password",
                        "ramos"));
nameValuePairs.add(new BasicNameValuePair("fullname",
                        "mark"));
nameValuePairs.add(new BasicNameValuePair("email",
                        "yyy@gmail.com"));
nameValuePairs.add(new BasicNameValuePair("mobile_prefix",
                        "91"));
nameValuePairs.add(new BasicNameValuePair("mobile_suffix",
                        "1234567890"));
nameValuePairs.add(new BasicNameValuePair("mode", "app"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String responseBody = httpclient.execute(httppost,
                        responseHandler);

谢谢

4

0 回答 0