function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Make https call-outs using self-sign certificate from web server



I've been searching around the possibility in Salesforce to use self-sign certificate from a webserver, to make a https web request call.

My scenario was, Salesforce send a request to connect with server X, authenticated with username, password and self-sign certificate from server X.

With a HttpRequest class, set the endpoint url and set the username and password in Authorization Header, I've got an error message 

System.CalloutException: PKIX path building failed: unable to find valid certification path to requested target

The Web server, I need to connect to, has a self-signed certificate which should be included in the call-outs for the Authentification. Since I didn't see any possibility for me to upload the self-sign certificate from a third party and set it up in the HttpRequest class.



How can I solve this problem?


I red an article that in Java we can set the request manually to ignored self-signed certificates request, but I don't know if it is possible to implement in Apex Code.







You can solve your problem in 2 ways as far as I think:

(1)Bringing some middle-ware in between:SF will make request to the middleware and the middle-ware in turn will call the server X.But 1 thing,the middle ware shoul be able to accept the request coming.(As a middleware we can write java code also).

(2) upgrade the certificate of Server X with any certificate signed by a CA that is trusted by salesforce.


Through apex code we cant solve it directly.