Android 上使用 DefaultHttpClient 时 https 返回 404?

发布于 2024-09-20 00:01:24 字数 3563 浏览 3 评论 0原文

我有一个 http 请求,其工作方式为 http://blah.com,现在我被要求使用 https://blah.com

前者有效,后者因网络 I/O 错误而失败。客户端是否缺少我需要的参数设置?

URL请求:

D/MyAppWebservice(23142): http-transform :) [https://cdp.mobibob.com:8151/DoTransaction]

以下是日志:

E/MyAppContentProvider(23142): com.mobibob.myapp.MyAppExceptions$ParseException: Network or I/O error calling web service.
W/System.err(23142): com.mobibob.myapp.MyAppExceptions$ParseException: Network or I/O error calling web service.
W/System.err(23142):    at com.mobibob.myapp.MyAppWebservice.queryApi(MyAppWebservice.java:558)
W/System.err(23142):    at com.mobibob.myapp.MyAppContentProvider.queryWebservice(MyAppContentProvider.java:751)
W/System.err(23142):    at com.mobibob.myapp.MyAppContentProvider.query(MyAppContentProvider.java:440)
W/System.err(23142):    at android.content.ContentProvider$Transport.query(ContentProvider.java:130)
W/System.err(23142):    at android.content.ContentResolver.query(ContentResolver.java:202)
W/System.err(23142):    at com.mobibob.myapp.ui.DownloadActivity.goGenDownloadTransaction(DownloadActivity.java:168)
W/System.err(23142):    at com.mobibob.myapp.ui.DownloadActivity$DownloadTransaction.doInBackground(DownloadActivity.java:90)
W/System.err(23142):    at com.mobibob.myapp.ui.DownloadActivity$DownloadTransaction.doInBackground(DownloadActivity.java:1)
W/System.err(23142):    at android.os.AsyncTask$2.call(AsyncTask.java:185)
W/System.err(23142):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
W/System.err(23142):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
W/System.err(23142):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
W/System.err(23142):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
W/System.err(23142):    at java.lang.Thread.run(Thread.java:1096)
W/System.err(23142): Caused by: java.io.IOException: SSL handshake failure: I/O error during system call, Unknown error: 0
W/System.err(23142):    at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativeconnect(Native Method)
W/System.err(23142):    at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:305)
W/System.err(23142):    at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:92)
W/System.err(23142):    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:321)
W/System.err(23142):    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:129)
W/System.err(23142):    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
W/System.err(23142):    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
W/System.err(23142):    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
W/System.err(23142):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
W/System.err(23142):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
W/System.err(23142):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
W/System.err(23142):    at com.mobibob.myapp.MyAppWebservice.queryApi(MyAppWebservice.java:510)
W/System.err(23142):    ... 13 more

I have an http request that worked as http://blah.com and now I have been asked to use https://blah.com

The former works and the later fails with a Network I/O error. Are there any missing parameter settings that I need for the client?

The URL request:

D/MyAppWebservice(23142): http-transform :) [https://cdp.mobibob.com:8151/DoTransaction]

Following is the log:

E/MyAppContentProvider(23142): com.mobibob.myapp.MyAppExceptions$ParseException: Network or I/O error calling web service.
W/System.err(23142): com.mobibob.myapp.MyAppExceptions$ParseException: Network or I/O error calling web service.
W/System.err(23142):    at com.mobibob.myapp.MyAppWebservice.queryApi(MyAppWebservice.java:558)
W/System.err(23142):    at com.mobibob.myapp.MyAppContentProvider.queryWebservice(MyAppContentProvider.java:751)
W/System.err(23142):    at com.mobibob.myapp.MyAppContentProvider.query(MyAppContentProvider.java:440)
W/System.err(23142):    at android.content.ContentProvider$Transport.query(ContentProvider.java:130)
W/System.err(23142):    at android.content.ContentResolver.query(ContentResolver.java:202)
W/System.err(23142):    at com.mobibob.myapp.ui.DownloadActivity.goGenDownloadTransaction(DownloadActivity.java:168)
W/System.err(23142):    at com.mobibob.myapp.ui.DownloadActivity$DownloadTransaction.doInBackground(DownloadActivity.java:90)
W/System.err(23142):    at com.mobibob.myapp.ui.DownloadActivity$DownloadTransaction.doInBackground(DownloadActivity.java:1)
W/System.err(23142):    at android.os.AsyncTask$2.call(AsyncTask.java:185)
W/System.err(23142):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
W/System.err(23142):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
W/System.err(23142):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
W/System.err(23142):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
W/System.err(23142):    at java.lang.Thread.run(Thread.java:1096)
W/System.err(23142): Caused by: java.io.IOException: SSL handshake failure: I/O error during system call, Unknown error: 0
W/System.err(23142):    at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativeconnect(Native Method)
W/System.err(23142):    at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:305)
W/System.err(23142):    at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:92)
W/System.err(23142):    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:321)
W/System.err(23142):    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:129)
W/System.err(23142):    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
W/System.err(23142):    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
W/System.err(23142):    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
W/System.err(23142):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
W/System.err(23142):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
W/System.err(23142):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
W/System.err(23142):    at com.mobibob.myapp.MyAppWebservice.queryApi(MyAppWebservice.java:510)
W/System.err(23142):    ... 13 more

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寄人书 2024-09-27 00:01:24

https 几乎总是意味着使用不同的端口(标准 http=>80;标准 https=>443)。您有一个硬编码端口 (8151)。我猜测 https servlet 正在侦听不同的端口。

或者您正在尝试连接到不支持 https 的服务器。

Https almost always implies a different port being used (standard http=>80; standard https=>443). You have a hardcoded port (8151). I'm guessing the https servlet is listening on a different port.

Or you're trying to connect to a server that doesn't support https.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文