如何使用Spring WebServiceTemplate禁用SSL证书检查?

时间:2015-06-25 15:56:54

标签: java spring web-services ssl

为了在开发环境中进行测试,我想忽略我的开发服务器的peep=chicken("Peep", "yes", "Gallus Domesticus") peep.change_eatable("meatballs") peep.print_eatable() 证书问题。

我的网络服务客户端: -

https

有许多类似的问题帮助我找到解决方案,但我想我会在这里为任何需要它的人发布这个具体问题的答案....

1 个答案:

答案 0 :(得分:9)

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

然后

class UnTrustworthyTrustManager
        implements X509TrustManager
{
    public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {}
    public void checkServerTrusted(X509Certificate[] arg0, String arg1)throws CertificateException {}
    public X509Certificate[] getAcceptedIssuers() { return null; }
}

(需要spring-ws-support)