【发布时间】:2011-06-02 14:53:02
【问题描述】:
我有一个应用程序连接到使用 Entrust 有效证书的 Web 服务。唯一的区别是它是通配符 SSL。
问题是:我得到一个
ERROR/NoHttpResponseException(5195): org.apache.http.NoHttpResponseException: The target server failed to respond
当我使用 3G 时。在 WIFI 上它可以工作,在模拟器上它可以工作,通过我的手机 3G 连接模拟器可以工作。但是我手机上的 3G 应用程序根本不起作用。在 2 个不同网络(Virgin Mobile Canada 和 Fido)上的 HTC Legend CM7.0.3(2.3.3) 和 Nexus S 2.3.3 上进行了测试。
我的设备中有一个 PCAP 转储显示一些错误,但我不太了解它。
确认号:TCP 损坏。 ACK 标志未设置时,确认字段为非零
我也尝试过修复这个question 这个question。我不知道还能去哪里。
顺便说一下,网络服务可以在 3G 上使用浏览器。
我们还使用 HttpRequestInterceptor 的基本身份验证。
我想这就是我能提供的所有细节。如果需要其他内容,请随时询问。
这个question 也有关系,我都试过了,都不管用。
编辑
我开始认为这可能更适合 serverfault.com
这是转储file 和截图
编辑 2
这是我用来连接到相关网络服务的代码。
protected HttpEntity sendData(List<NameValuePair> pairs, String method)
throws ClientProtocolException, IOException,
AuthenticationException {
pairs.add(new BasicNameValuePair(KEY_SECURITY, KEY));
pairs.add(new BasicNameValuePair(LANG_KEY, lang));
pairs.add(new BasicNameValuePair(OS_KEY, OS));
pairs.add(new BasicNameValuePair(MODEL_KEY, model));
pairs.add(new BasicNameValuePair(CARRIER_KEY, carrier));
DefaultHttpClient client = getClient();
HttpPost post = new HttpPost();
try {
post.setHeader("Content-Type", "application/x-www-form-urlencoded");
post.setEntity(new UrlEncodedFormEntity(pairs));
} catch (UnsupportedEncodingException e1) {
Log.e("UnsupportedEncodingException", e1.toString());
}
URI uri = URI.create(method);
post.setURI(uri);
client.addRequestInterceptor(preemptiveAuth, 0);
HttpHost target = new HttpHost(host, port, protocol);
HttpContext httpContext = new BasicHttpContext();
HttpResponse response = client.execute(target, post, httpContext);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 401) {
throw new AuthenticationException("Invalid username or password");
}
return response.getEntity();
}
【问题讨论】:
-
你能添加一些相关的代码,也许会有所帮助。
-
@Nicklas A,添加了一些代码。如果需要特定的东西,请询问。