http://192.168.101.111:7000/MyService.svc/home/updatejob/4600/XCV13030001/TTTT0000/CCCC0000/SSSS0000
我可以通过Advance rest客户端对此网址发帖,这样可以正常工作。这是我的android代码实现
public boolean updateInfo() {
boolean result = false;
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("sbDriverID", sbDriverID.toString()));
params.add(new BasicNameValuePair("sbJobNumber", sbJobNumber.toString()));
params.add(new BasicNameValuePair("sbTrailerNumber", sbTrailerNumber.toString()));
params.add(new BasicNameValuePair("sbContainerNumber", sbContainerNumber.toString()));
params.add(new BasicNameValuePair("sbSealNumber", sbSealNumber.toString()));
try {
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(params, "UTF-8");
httpPost.setEntity(entity);
HttpResponse httpResponse = httpClient.execute(httpPost);
if (httpResponse != null) {
if (httpResponse.getStatusLine().getStatusCode() == 204)
result = true;
}
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
这给了我一个404.我努力了,找不到理由。
答案 0 :(得分:0)
您是否尝试从无法连接的相同Android设备打开网址(使用浏览器)?也许Android设备位于不同的域中。