[SalesForce] “System.CalloutException: IO Exception: java.security.cert.CertificateException: No subject alternative names present”

I'm facing “System.CalloutException: IO Exception: java.security.cert.CertificateException: No subject alternative names present” error when I try to make a callout to an external webservice. Problem is when I try it from SOAPUI webservice works ok.

When I try to open the endpoint from Chrome it says server certificate does not match with URL. I think problem might be about this. I've searched for this problem and I'm afraid it'll require for me to contact webservice provider. Is there any other way to fix this problem?

Best Answer

In brief, you will have to contact your webservice provider.

SAN (Subject Alternative Name) of Webervice is not matching the CN (Common Name) host name.

Try to set the certificate name as:

// Contact the service provider to get the name if not known.
request.setClientCertificateName('name_of_certificate').


If above step didn't work, you will have to do following steps to resolve this:

  1. Create 'CA-Signed' Certificate in Salesforce.
  2. Download Certificate Signing Request.
  3. Send the downloaded certificate to webservices provider for signing the certificate.
  4. Once the signed certificate is received, upload the signed certificate in your Salesforce.
  5. In apex code set certificate name by request.setClientCertificateName('name_of_certificate');.
Related Topic