我见过很多类似的问题在这里,但无法找到解决方案。 我在X10溢价主持一个Web服务的PHP文件。 我买了他们的SSL证书,并可以通过HTTPS访问上的浏览器和iPhone上的应用程序我的网页。 我无法做同样在Android应用程式。
我尝试了许多解决方案,但不断收到SSL错误。 我想这个教程http://www.makeurownrules.com/secure-rest-web-service-mobile-application-android.html ,但我发现
10-04 07:21:57.081: W/System.err(6804): javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x2a1a11a8: Failure in SSL library, usually a protocol error
10-04 07:21:57.081: W/System.err(6804): error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0x471f5756:0x00000000)
10-04 07:21:57.091: W/System.err(6804): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:436)
10-04 07:21:57.123: W/System.err(6804): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.<init (OpenSSLSocketImpl.java:647)
10-04 07:21:57.123: W/System.err(6804): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:618)
10-04 07:21:57.123: W/System.err(6804): at org.apache.http.impl.io.SocketInputBuffer.<init>(SocketInputBuffer.java:70)
10-04 07:21:57.131: W/System.err(6804): at org.apache.http.impl.SocketHttpClientConnection.createSessionInputBuffer(SocketHttpClientConnection.java:83)
10-04 07:21:57.131: W/System.err(6804): at org.apache.http.impl.conn.DefaultClientConnection.createSessionInputBuffer(DefaultClientConnection.java:170)
10-04 07:21:57.131: W/System.err(6804): at org.apache.http.impl.SocketHttpClientConnection.bind(SocketHttpClientConnection.java:106)
10-04 07:21:57.131: W/System.err(6804): at org.apache.http.impl.conn.DefaultClientConnection.openCompleted(DefaultClientConnection.java:129)
10-04 07:21:57.131: W/System.err(6804): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:172)
10-04 07:21:57.141: W/System.err(6804): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
10-04 07:21:57.141: W/System.err(6804): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
10-04 07:21:57.141: W/System.err(6804): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
10-04 07:21:57.141: W/System.err(6804): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
10-04 07:21:57.151: W/System.err(6804): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
10-04 07:21:57.151: W/System.err(6804): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
10-04 07:21:57.201: W/System.err(6804): at com.lablabla.parkme.ParkMeActivity.performUpdate(ParkMeActivity.java:233)
10-04 07:21:57.211: W/System.err(6804): at com.lablabla.parkme.ParkMeActivity.access$8(ParkMeActivity.java:220)
10-04 07:21:57.211: W/System.err(6804): at com.lablabla.parkme.ParkMeActivity$3.onClick(ParkMeActivity.java:215)
10-04 07:21:57.211: W/System.err(6804): at android.view.View.performClick(View.java:4084)
10-04 07:21:57.221: W/System.err(6804): at android.view.View$PerformClick.run(View.java:16966)
10-04 07:21:57.221: W/System.err(6804): at android.os.Handler.handleCallback(Handler.java:615)
10-04 07:21:57.221: W/System.err(6804): at android.os.Handler.dispatchMessage(Handler.java:92)
10-04 07:21:57.241: W/System.err(6804): at android.os.Looper.loop(Looper.java:137)
10-04 07:21:57.241: W/System.err(6804): at android.app.ActivityThread.main(ActivityThread.java:4745)
10-04 07:21:57.251: W/System.err(6804): at java.lang.reflect.Method.invokeNative(Native Method)
10-04 07:21:57.251: W/System.err(6804): at java.lang.reflect.Method.invoke(Method.java:511)
10-04 07:21:57.271: W/System.err(6804): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-04 07:21:57.271: W/System.err(6804): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-04 07:21:57.281: W/System.err(6804): at dalvik.system.NativeStart.main(Native Method)
10-04 07:21:57.291: W/System.err(6804): Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x2a1a11a8: Failure in SSL library, usually a protocol error
10-04 07:21:57.291: W/System.err(6804): error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0x471f5756:0x00000000)
10-04 07:21:57.311: W/System.err(6804): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
10-04 07:21:57.311: W/System.err(6804): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:395)
我在这里尝试了其他建议在SO,接受所有证书,因为我在做我自己的web服务的调用,并相信所有证书。
另一件事,我可以在浏览器中,并通过HTTP连接的iPhone应用程序,我的web访问。 但是,当我试图让它在Android中,我收到回包含HTML响应
10-04 07:29:47.662: D/RESULT(6900): instead of REQUEST_URI, we could show absolute URL via:
10-04 07:29:47.662: D/RESULT(6900): http://HTTP_HOST/REQUEST_URI
10-04 07:29:47.662: D/RESULT(6900): but what if its https:// or other protocol?
10-04 07:29:47.662: D/RESULT(6900):
10-04 07:29:47.662: D/RESULT(6900): SERVER_PORT_SECURE doesn't seem to be used
10-04 07:29:47.662: D/RESULT(6900): SERVER_PORT logic would break if they use alternate ports
10-04 07:29:47.662: D/RESULT(6900): -->
10-04 07:29:47.662: D/RESULT(6900): <h1>404 Not Found</h1>
有任何想法吗?
谢谢!