2016-11-02 52 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