Hi Experts,
I have to make a http call to a third party url with https (Eg., https://<exthost>/path/example) from the application server Java. So, i implemented the below code.
CloseableHttpClient httpClient = HttpClients.createDefault();
//HttpPost postRequest = new HttpPost(UtilMethods.getEzPayRegisterUrl(request));
HttpPost req = new HttpPost("https://host/path/example");
HttpResponse ezpayResponse = httpClient.execute(req);
On deploying this code in a web module project and running it, I'm getting the below exception in the logs.
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
On browsing about this exception, I found that it required the certificate to be added to the trusted store of the server. So, i got the certificate by opening this third party url in the browser and copied the certificate to a file (X509 .cer). And, under NWA->Configuration->Security->Certificate and Keys, I imported the certificates for the view 'TrustedCAs'. But, still i face the same issue.
Am I missing something here? Kindly help me in this regard.
Thanks & Regards
Vijay.K