在我的應用我將用戶信息發送到服務器的HTTP如下,我得到org.apache.http.client.HttpResponseException:未找到,我有花更多的時間,但無法解決。請幫助我找出解決方案。的Android org.apache.http.client.HttpResponseException:未找到
我得到錯誤在這行:
jsonResponse = httpClient.execute(httpPost,resHandler);
public String addNewCardDetail(String loggedin_id, String fn, String ln,
String cardholdername, String cardno,String cvv, String expdate, String add,
String state, String city, String pincode) {
jsonResponse = "";
httpClient = new DefaultHttpClient();
resHandler = new BasicResponseHandler();
httpPost = new HttpPost("http://xxx.xxx.xxx.xx/users/createCustomerCardAddress");
nameValuePairs = new ArrayList<NameValuePair>(11);
nameValuePairs.add(new BasicNameValuePair("loggedin_id",loggedin_id));
nameValuePairs.add(new BasicNameValuePair("firstname",fn));
nameValuePairs.add(new BasicNameValuePair("lastname",ln));
nameValuePairs.add(new BasicNameValuePair("cardHolderName",cardholdername));
nameValuePairs.add(new BasicNameValuePair("cardNumber",cardno));
nameValuePairs.add(new BasicNameValuePair("cardCvv",cvv));
nameValuePairs.add(new BasicNameValuePair("expDate",expdate));
nameValuePairs.add(new BasicNameValuePair("address",add));
nameValuePairs.add(new BasicNameValuePair("state",state));
nameValuePairs.add(new BasicNameValuePair("city",city));
nameValuePairs.add(new BasicNameValuePair("pincode",pincode));
Log.e("----------", "---------");
for (int i = 0; i < nameValuePairs.size(); i++) {
Log.e("add/edit new card", nameValuePairs.get(i).getName());
Log.e("add/edit new card", nameValuePairs.get(i).getValue());
}
Log.e("----------", "---------");
try {
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
jsonResponse = httpClient.execute(httpPost, resHandler); // I get org.apache.http.client.HttpResponseException: Not Found
Log.e("add edit card response", "-"+jsonResponse);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return jsonResponse;
}
我的日誌跟蹤:
org.apache.http.client.HttpResponseException: Not Found
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:71)
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:59)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:773)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:743)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
at com.fssd.spot.parser.ParsorClass.addNewCardDetail(ParsorClass.java:1098)
at com.fssd.spot.payment.BillingAddress$AddNewcard.doInBackground(BillingAddress.java:146)
at com.fssd.spot.payment.BillingAddress$AddNewcard.doInBackground(BillingAddress.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
可以請您發佈堆棧跟蹤? – Emmanuel
@Emmanuel,我添加了異常的日誌追蹤。 –