문제

I'm using Axis 1.4 in my client app to make SOAP calls. I am calling services over HTTPS. Some services use self signed certificates, others use certificates issued by a certificate authority.

I've used the code from this answer to add the self signed certificate to my trust store. My problem is that the truststore is being used for all calls - even the one's to servers that have a valid certificate from a CA.

Is there anyway to tell Axis to only use the truststore for servers that have self signed certificates ?

도움이 되었습니까?

해결책

It's essentially the same issue as here (except that this was for client-certificate authentication).

You'll need to create your own socket factory class and pass it to axis using this property:

AxisProperties.setProperty("axis.socketSecureFactory",
    "com.example.MySSLSocketFactory");

(See org.apache.axis.components.net.SecureSocketFactory.)

Since you already have a working SSLContext, instead of setting it as the default context, you need to create a javax.net.ssl.SSLSocketFactory from it and use this to create the socket within the Apache Axis socket factory.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top