简体   繁体   中英

Specify SSLContext for SOAP Client Using Apache CXF

So we have a SOAP client that's been working and the customer recently switched the server over to use SSL with a self-signed certificate. Now I'm trying to figure out how to get our client the correct SSL context to use. I found a related question here ; but I don't see how to tie it into my code (relevant portions summarized below - DCAMethods[Soap] is a cxf generated interface).

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); 

I assume you need SSL with two ways authentication and not signing the SOAP message

CXF has its own support to SSL connections using client certificates. It uses the Java SSLContext but all the configuration is done via CXF configuration files

See my answer https://stackoverflow.com/a/37610607/6371459 at step 4 to view how to configure CXF with a spring file or programatically. The full documentation for SSL Support is here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM