主机名没有被证实ANDROID [英] Hostname was not verified ANDROID
问题描述
我使用 KSOAP
lib中调用 Web服务
。在某些情况下,服务正常运行,但在情况下,它提供了主机名未验证
下面是我的code调用 Web服务
。
HttpTransportSE httpTransport =新HttpTransportSE(URL,MessageConstant.TIMEOUT_TIME);
httpTransport.debug = TRUE; //这是可选的,使用它,如果你不希望使用数据包嗅探器来检查一下发送消息是(httpTransport.requestDump)
httpTransport.call(SOAP_ACTION,信封); // 发送请求
这是我的日志猫一样
java.io.IOException异常:主机名XXX.XX.XXX.XXX未经过验证
在libcore.net.http.HttpConnection.verifySecureSocketHostname(HttpConnection.java:223)
在libcore.net.http.HttpsURLConnectionImpl $ HttpsEngine.connect(HttpsURLConnectionImpl.java:446)
在libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
在libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
在libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
在libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:165)
在org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:76)
在org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:152)
在org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
该链接有几个可能的原因;无响应的被标记接受
您也应该看看这里:
一个原因发生这种情况是由于服务器配置错误。该
服务器配置不具有受试者的证书
或匹配您是服务器的使用者替代名称字段
试图达成。有可能有一个证书的使用
许多不同的服务器。
例如,望着google.com
与的OpenSSL的s_client.First -connect google.com:443证书| OpenSSL的
你可以看到,支持主题* .google.com但
X509 -text
对于同样受替代名称* .youtube.com,* .android.com和
其他。只有当服务器名称要连接出现的错误
以不是由证书作为可接受列出。
块引用>I am using
ksoap
lib to call thewebservice
. In some cases service run correctly but in a case it gives Host name was not verified below is my code for callingwebservice
.HttpTransportSE httpTransport = new HttpTransportSE(URL, MessageConstant.TIMEOUT_TIME); httpTransport.debug = true; // this is optional, use it if you don't want to use a packet sniffer to check what the sent message was (httpTransport.requestDump) httpTransport.call(SOAP_ACTION, envelope); // send request
here is my log cat for the same
java.io.IOException: Hostname 'XXX.XX.XXX.XXX' was not verified at libcore.net.http.HttpConnection.verifySecureSocketHostname(HttpConnection.java:223) at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:446) at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289) at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239) at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80) at libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:165) at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:76) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:152) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
解决方案This link has several possible causes; none of the responses were marked "accepted":
You should also look here:
One reason this can happen is due to a server configuration error. The server is configured with a certificate that does not have a subject or subject alternative name fields that match the server you are trying to reach. It is possible to have one certificate be used with many different servers.
For example, looking at the google.com certificate with
openssl s_client -connect google.com:443 | openssl x509 -text
you can see that a subject that supports *.google.com but also subject alternative names for *.youtube.com, *.android.com, and others. The error occurs only when the server name you are connecting to isn't listed by the certificate as acceptable.
这篇关于主机名没有被证实ANDROID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!