8

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());
9

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. Check out: http://wiki.developerforce.com/page/Making_Authenticated_Web_Service_Callouts_Using_Two-Way_SSL

Here's a pointer as to which CA's are accepted as valid authorities by SF: http://success.salesforce.com/ideaView?id=08730000000JziE

  • Can you please explain me whats unencrypted http?And how i go about it ? – Mohith Shrivastava Dec 20 '12 at 11:04
  • Change from: req.setEndpoint('https:...'); to req.setEndpoint('http:...'); – Martin Peters Dec 20 '12 at 11:05
  • i added only http but this gave me an exception of 301 .Moved permanently.any idea?Thanks lot for your help – Mohith Shrivastava Dec 20 '12 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. – Martin Peters Dec 20 '12 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 '15 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.