【发布时间】:2013-01-03 16:44:25
【问题描述】:
我从 HTTPS 得到 Json 响应并得到异常
javax.net.ssl.SSLException: Not trusted server certificate
以下是我的代码,无论我尝试使用 HttpGet 还是 HttpPost,我都会在该行得到异常
HttpResponse httpResponse = httpClient.execute(request);
这些是下面用于从 url 获取数据的代码。
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost request = new HttpPost(urlString);
HttpResponse httpResponse = httpClient.execute(request);
希望得到这个问题的答案。谢谢。
【问题讨论】:
-
参见this 使用 DefaultHttpClient 发出 https 请求
-
不是 json 响应。没有堆栈跟踪。您的服务器使用了您的设备不信任的证书,这就是错误所说的。