Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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://nigel.stg.taluslabs.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());
share|improve this question

1 Answer 1

up vote 6 down vote accepted

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

share|improve this answer
    
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
4  
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
    
thanks for your insight and heartfelt thanks .I accepted your answer too –  Mohith Shrivastava Dec 20 '12 at 12:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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