Https在Android上使用DefaultHttpClient返回404?

时间:2010-09-16 20:58:02

标签: android ssl https http-status-code-404 httpclient

我的http请求有效http://blah.com,现在我被要求使用https://blah.com

前者工作,后者因网络I / O错误而失败。我需要为客户端设置缺少的参数设置吗?

网址请求:

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

1 个答案:

答案 0 :(得分:1)

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

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