• Vinod.Jain
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

I have to make callout to an external REST service from salesforce. Service provider has shared an 'HTTPS' endpoint with me.

I am able to access the service by simply pasting service endpoint in browser, and it returns a JSON response. But when I try to invoke same endpoint from Salesforce it does not work and gives below error:

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

I contacted my service provider and they mentioned that the service is working in browser because the browser trusts my service provider's certificate and similarly Salesforce should also trust the certificate.

I downloaded the certificate from the browser and tried to add it to callout as in Approach-1 and Approach-2 below. And also tried to add a salesforce self-signed certificate as in Approach-3 below. But every time I get the same error.

HttpRequest request = new HttpRequest();
String endpoint = 'https://serviceprovider.com/querystring';
request.setEndPoint(endpoint);

///Approach-1////
//String cert1 = 'certificate details';
//request.setClientCertificate(cert1,'password');

///Approach-2////
//String cert1 = 'certificate details';
//String cert2 = EncodingUtil.base64Encode(Blob.valueOf(cert1));
//request.setClientCertificate(cert2,'password');

///Approach-3////
request.setClientCertificateName('Testing');

request.setMethod('GET');
HttpResponse response = httpProtocol.send(request);
System.debug('######'+response.getBody());

Any help to resolve the issue will be appriciated.
Thanks in advance.

I am a consultant working on Salesforce CRM. I am looking for a product using which I can connect to a SQL database on a user action and fetch data to Salesforce. The requirement is to fetch data from some applications running on SQL-2005, and display that data in Salesforce on user request. We do not want to store that data in Salesforce.

 

I am looking for an option other than creating web-service. Let me know if there are any other options/approaches.

Any help/suggestion will be highly appriciated.

 

Thanks

I have to make callout to an external REST service from salesforce. Service provider has shared an 'HTTPS' endpoint with me.

I am able to access the service by simply pasting service endpoint in browser, and it returns a JSON response. But when I try to invoke same endpoint from Salesforce it does not work and gives below error:

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

I contacted my service provider and they mentioned that the service is working in browser because the browser trusts my service provider's certificate and similarly Salesforce should also trust the certificate.

I downloaded the certificate from the browser and tried to add it to callout as in Approach-1 and Approach-2 below. And also tried to add a salesforce self-signed certificate as in Approach-3 below. But every time I get the same error.

HttpRequest request = new HttpRequest();
String endpoint = 'https://serviceprovider.com/querystring';
request.setEndPoint(endpoint);

///Approach-1////
//String cert1 = 'certificate details';
//request.setClientCertificate(cert1,'password');

///Approach-2////
//String cert1 = 'certificate details';
//String cert2 = EncodingUtil.base64Encode(Blob.valueOf(cert1));
//request.setClientCertificate(cert2,'password');

///Approach-3////
request.setClientCertificateName('Testing');

request.setMethod('GET');
HttpResponse response = httpProtocol.send(request);
System.debug('######'+response.getBody());

Any help to resolve the issue will be appriciated.
Thanks in advance.