cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
299
Views
0
Helpful
0
Replies

Getting SSL exception in local environment: for the httpclient post API (HTTPS URL) developed in another dashboard

NileshBajbalkar
Cisco Employee
Cisco Employee

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:

  1. Previously project configured with Java 7 and later tried with Java 8, still it gives same error.
  2. 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.

0 Replies 0
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: