How to set up Apache CXF client to use WebSphere truststore? (Receiving “No trusted certificate found” exception.)

后端 未结 4 777
情深已故
情深已故 2020-12-31 14:19

First, I\'ll start with a summary. I\'m using an Apache CXF client to communicate over SSL with an Apache CXF service provider that is using a self-signed certificate. I i

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-31 14:49

    beny23's solution works great for me on WAS7, with the following modifications (reason: httpConduit.getTlsClientParameters() might be null):

    Replace this part:

        TLSClientParameters tlsClientParameters = httpConduit.getTlsClientParameters();
        if (tlsClientParameters != null) {
          tlsClientParameters.setSSLSocketFactory(factory);
        }
    

    With this:

        TLSClientParameters tlsClientParameters = httpConduit.getTlsClientParameters();
        if (tlsClientParameters == null) {
          tlsClientParameters = new TLSClientParameters();
          httpConduit.setTlsClientParameters(tlsClientParameters);
        }
        tlsClientParameters.setSSLSocketFactory(factory);
    

提交回复
热议问题