[SalesForce] Way to get around SSL certificate errors when calling an external web service

I'm using WebServiceCallout.invoke in an Apex class to call an external SOAP web service (namely the SOAP API for Central Desktop).

Unfortunately, the external service has an invalid SSL certificate for its API endpoint, so I'm getting the following error:

System.CalloutException: IO Exception: java.security.cert.CertificateException:
No subject alternative DNS name matching accountname.api.centraldesktop.com found.

The problem is basically that the external service has a wildcard certificate for *.centraldesktop.com but the certificate is not valid for *.api.centraldesktop.com. Therefore, the API endpoint causes this error.

Ideally the external service can fix its SSL certificate, but barring that option, I'm looking for a work-around in Salesforce. Is there a way to ignore the certificate error when using WebServiceCallout.invoke in Salesforce?

Best Answer

Is there a way to ignore the certificate error when using WebServiceCallout.invoke in Salesforce?

Nope - no SSL_VERIFYPEER or SSL_VERIFYHOST flags for you to set here ;-) but:

  1. can you try api.centraldesktop.com or accountname.centraldesktop.com

  2. definitely approach the vendor as you've indicated (you won't be the first!)

  3. you could proxy the requests and disregard the certificate/hostname mismatch on your proxy