When trying to call one of our external web services from apex code, I get an error stating that it is unable to find valid certification path to requested target.
System.CalloutException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
According to what I googled regarding the error, it seems there is a issue validating the ssl certificate for our service. I spoke with the admin person for that server and he told me it is not expired, verified CA through thawte, plus other outside software is accessing it without any issues.
We also tried going to "Certificate and Key Management" in salesforce and select "Import from Keystore" but not sure what JKS file to import. I do have the cert file but not sure how salesforce can use it. Is there something we need to put into the keystore and then import it into the organization? DO we have to create a new certificate under "Certificate and Key Management" and then use that as the certificate for our external web service?
The external web service that I'm trying to access is, apps.daikinapplied.com/McQuayToolsSrvc/Authentication.asmx Some of the operations on this service that I am using are: SalesPortalUrl () ValidateSession(double sessionId) GetUserInfoBySessionId (double sessionId) It works with all other .net applications and I also verified that it works in wcftestclient (microsoft tool). I added the following Remote Site in salesforce: apps.daikinapplied.com
In Developer Console I tested access with the following code which produces the exception error:
Http h = new Http();
HttpRequest req = new HttpRequest();
// NOTE: For the requestString variable below the editor here wouldn't let me add the < symbol in front of the tags. Not sure why
String requestString = 'soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' + 'soap:Body>' + 'SalesPortalUrl xmlns="http://tempuri.org/" />' + '/soap:Body>' + '/soap:Envelope>';
HttpResponse res = h.send(req);
Any help you can provide would be appreciated!