我收到旧的HTTP transport error: javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name
服务错误,因为我需要禁用SNI握手,因为原因。我不想用System.setProperty("jsse.enableSNIExtension", "false");
在全球范围内完成,如其他地方所建议的那样,http绑定使用sun.net.www.protocol.https.HttpsClient
,我似乎无法改变这一点。我曾尝试方法,如https://erikwramner.wordpress.com/2013/03/27/trust-self-signed-ssl-certificates-and-skip-host-name-verification-with-jax-ws/以sun.net编程和暂时禁用JAX-RS客户端的SNI检查**。HttpsClient
我在那里设置自定义SSLSocketFactories和HostnameVerifiers像这样:
BindingProvider bp = (BindingProvider) webServicePort;
Map requestContext = bp.getRequestContext();
requestContext.put("com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory", getTrustingSSLSocketFactory());
requestContext.put("com.sun.xml.ws.transport.https.client.SSLSocketFactory", getTrustingSSLSocketFactory());
final NaiveHostnameVerifier naiveHostnameVerifier = new NaiveHostnameVerifier();
requestContext.put("com.sun.xml.internal.ws.transport.https.client.hostname.verifier", naiveHostnameVerifier);
requestContext.put("com.sun.xml.ws.transport.https.client.hostname.verifier", naiveHostnameVerifier);
这根本没有任何影响,因为HTTP客户端似乎没有兑现这些属性。
任何提示赞赏!