NotNormal
NotNormal

Reputation: 125

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

Upvotes: 0

Views: 4061

Answers (1)

pedrofb
pedrofb

Reputation: 39291

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

Upvotes: 1

Related Questions