2016-11-02 51 views
0

因此,我们有一个工作正常的SOAP客户端,最近客户将服务器切换到使用带有自签名证书的SSL。现在我试图弄清楚如何让我们的客户端使用正确的SSL上下文。我发现一个相关的问题here;但我不明白如何将其与我的代码绑定(相关部分概述如下 - DCAMethods [Soap]是一个cxf生成的接口)。使用Apache CXF为SOAP客户端指定SSLContext

File tmp = cacheWsdl(UUID.randomUUID().toString(), new URL(wsdlLocation), anzoSSLContext); 
// It would be useful to specify the SSLContext here, but I am working around that. 
DCAMethods methods = new DCAMethods(tmp.toURI().toURL()); 
DCAMethodsSoap soapInterface = methods.getDCAMethodsSoap(); 
// Need to specify the SSLContext for this call. 
String rawXmlData = (String) soapInterface.getCopy(connectionId, username, password, documentVersionId, rendition); 

回答

0

我假设你需要用两种方式验证SSL和不签署SOAP消息

CXF都有自己的使用客户证书的SSL连接的支持。它使用Java SSLContext,但所有配置都通过CXF配置文件完成

在步骤4查看我的回答https://stackoverflow.com/a/37610607/6371459查看如何使用spring文件或以编程方式配置CXF。 SSL支持的完整文档是here