只是一点启动信息。我正在编写一个Andorid应用程序,该应用程序使用MVC平台与使用C#.Net编写的服务器通信。每个请求都是一个帖子,一个ActionFilter属性可以确保这一点。但是,由于.Net问题将HttpMethod解析为“ST”。为什么我的HttpPost请求被分解为两个请求?
以下是我使用全球,从我的应用程序使Web请求的代码:
private String MakeRequest(String action, String params){
try {
HttpPost request = new HttpPost(mProtocol + mSubDomain + mHost + action);
String args;
if (params != null) {
args = params;
} else {
args = "[]";
}
StringEntity requestEntity;
requestEntity = new StringEntity(args);
requestEntity.setContentType("application/json;charset=UTF-8");
requestEntity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"application/json;charset=UTF-8"));
request.setEntity(requestEntity);
HttpResponse response = mHttpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
String jString = EntityUtils.toString(responseEntity);
return jString;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
我只是有这个问题与一个特定方法的所有其它方法工作得很好。
以下链接指向包含流量的pcap文件,以便它清晰可见。 (我已经将其过滤到只适用的行) http://dl.dropbox.com/u/315661/defect.pcap
另外值得一提的是,我看过它可能会工作一次,也许20-30次尝试。在一次成功的请求是一个单一的数据包。 – MitchellKrenz