Hi All,
Currently working on one functionality where I have to call one post API developed in another dashboard. It will act like public API which I can call from my current project and get the required response.
Current flow is like from UI when I hit one button, it will call local java service and that service will call this API using HttpClient post method. API URL is HTTPS URL.
Normally when I create simple standalone java class file having the httpclient post API call, it works and returns the response.
But when I integrate same code in my local project and call this service, it gives me following error when the service get hit
javax.net.ssl.SSLException: Received fatal alert: protocol_version
Following Solutions are tried:
- Previously project configured with Java 7 and later tried with Java 8, still it gives same error.
- Tried with other solution. It also did not worked.
System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
SSLContext sc = SSLContext.getInstance("TLSv1.2");
// Init the SSLContext with a TrustManager[] and SecureRandom()
sc.init(null, null, new java.security.SecureRandom());
Please let me know if any solution for this.
Thanks.