12

Error message :PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Hello all please see the above exception.I am getting a callout exception .Is any pointer on why the exception is ?

Http h = new Http();
    HttpRequest req = new HttpRequest();
    req.setMethod('GET');
    req.setEndpoint('https://xxxxx.stg.xxx.com/subscription/api/v1/accounts/');
    Oauth1 reuest=new Oauth1();
    reuest.sign(req);//This method generates me header 
    HttpResponse res = h.send(req);
    System.debug('RESPONSE BODY'+ res.getBody());

1 Answer 1

15

Visiting https://nigel.stg.taluslabs.com/subscription/api/v1/accounts/ I notice that your site/service isn't certified with an ssl certificate signed by some verified certificate authority (CA). Salesforce will therefore not accept the certificate and you get the exception you're seeing.

You can either switch to unencrypted http or buy a proper certificate or try making your web service talk to SF with certificates which are issued by a CA trusted by SF.

This is of course only possible if you control the endpoint you're trying to talk to.

To find supported Certificate visit url of your Salesforce environment using below format

https://<domain>.my.salesforce.com/cacerts.jsp
5
  • Can you please explain me whats unencrypted http?And how i go about it ? Dec 20, 2012 at 11:04
  • Change from: req.setEndpoint('https:...'); to req.setEndpoint('http:...'); Dec 20, 2012 at 11:05
  • i added only http but this gave me an exception of 301 .Moved permanently.any idea?Thanks lot for your help Dec 20, 2012 at 11:10
  • 5
    Since you're dealing with an oauth authenticated endpoint, I don't think skipping https is an especially good production-grade option. 301 probably means you've been redirected from http to https by the server meaning the server you're trying to talk to requires https. Dec 20, 2012 at 11:12
  • So if i understand well, the problem is link to the server which we are calling, and not the way we call the service. And it is a certificate issue as we are calling an https endpoint and not an http one.
    – vanessen
    Sep 10, 2015 at 10:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .