1

I'm trying to enable TLS 1.2 in a SOAPConnection in Java 7 running on Jboss 7.1. I have read that the property https.protocols works only whit HttpURLConnection:

System.setProperty("https.protocols", "TLSv1.2");

I have found a lot of solutions that say to use SSLContext:

SSLContext context = SSLContext.getInstance("TLSv1.2");
context.init(null, null, new SecureRandom());
SSLContext.setDefault(context);

I have placed the code before the creation of my SOAPConnectionFactory, but that doesn't work for me.

This is my code:

SOAPConnectionFactory soapFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapFactory.createConnection();

SOAPMessage soapResponse = soapConnection.call(soapMessage, url);

Did you have any solutions? Thank's a lot

EDIT: It works, if I declare the SSLContext in the Interceptor.

SPao
  • 11
  • 3
  • But did you try the `System.setProperty("https.protocols", "TLSv1.2")` solution? It may be "only" for HttpsURLConnection, but that includes everything that *uses* HttpsURLConnection too. – Gimby Oct 01 '20 at 15:33
  • Yes, I use it in my Interceptor, and I also put it before the SOAPConnectionFactory, but it doesn't work. – SPao Oct 01 '20 at 15:50
  • When you set the SSLContext, does it only do it for that call? Or does it set that globally? – dev4life Apr 05 '21 at 15:21

0 Answers0