6

I am trying to make a apex callout from salesforce to external system which is hosted inside in corporate firewall. Firewall sends the request to load-balancer which sends the request to appropriate web server.

I am getting below exception when trying this call from salesforce while I can getting correct response while making a callout from SOAP UI.

As per my client they don't provide any certificate. I am not sure what is happening and how to resolve the issue. As per log it seems like I need to install the certificates.

Any help would be appreciated.

Log -

[51]|System.HttpRequest[Endpoint=https://someURL/servlet/request, Method=POST]
07:51:12.268 (268755208)|CALLOUT_REQUEST|[51]|System.HttpRequest retrying request in response to handshake failure: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
07:51:12.423 (423017546)|EXCEPTION_THROWN|[51]|System.CalloutException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
07:51:12.423 (423110461)|SYSTEM_METHOD_EXIT|[51]|System.Http.send(ANY)
3
  • You should include more specifics about the SOAP request and the SFDC apex if you want help debugging this.
    – krigi
    Commented May 26, 2015 at 21:58
  • Its HTTP rest call which is working fine when I am making a callout from SOAPUI tool but same call is failing when trying from salesforce which used SSL 443 port. Commented May 27, 2015 at 13:22
  • krigi the exception indicates there is no response so the payload is irrelevant. Commented Aug 20, 2019 at 18:24

1 Answer 1

7

The error SunCertPathBuilderException is given when the certificate you are using for your server is not configured correctly.

This could be for a number of reasons. If you're site is accessible to the public, I'd recommend checking the servers SSL configuration with one (or both) of the following online tools:

Those tools should be able to debug a majority of the issues you may be seeing. If you can post back with results after running the tests that would be helpful.

Another reason that you may be getting the error is that you are using a cert that isn't trusted by salesforce (such as a self-signed certificate). Salesforce maintains a list of trusted CA certificates that you can check against:

Outbound Messaging SSL CA Certificates

1
  • 2
    +1 for non-trusted root CA (enterprise-signed cert) or a broken link in the chain of CAs presented on the cert being offered up by the web server. A self-signed cert is okay if it was generated by the org and installed on the webserver/loadbalancer as it would then be trusted by Salesforce.
    – Mark Pond
    Commented Nov 17, 2015 at 20:21

You must log in to answer this question.

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