1

We are building integration between Salesfoce and other system.

The other system has SOAP API to expose data and they implemented authication using certificates.

We genarateed class from WSDL. In the generated class system created three propeties clientCertName_x,clientCert_x and clientCertPasswd_x.

Steps we followed for Integration.

  1. Created Self signed certificate in Salesforce Sandbox environment.
  2. Downloaded Self signed certifation with .csr extension.
  3. Sent that to third party and imported that in there system.

    We are sending certificate name in clientCertName_x = 'abccertificate';

Then system throws error:

common.apex.runtime.impl.ExecutionException: Web service callout failed: WebService returned a SOAP Fault: An error occurred when verifying security for the message. faultcode=a:InvalidSecurity faultactor="|0x40aaa292"

Whenever we send clientCert_x from csr field then system throws error

System.CalloutException: Web service callout failed: clientCertPasswd_x can not be null

I am not sure about the clientCertPasswd_x property. How can I set it?

0

If you use clientCert_x, you also have to use clientCertPasswd_x. This is only used for legacy certificate integrations, as outlined in Using Certificates with SOAP Services. There's a code sample included on this page:

docSample.DocSamplePort stub = new docSample.DocSamplePort();
stub.clientCert_x =
'MIIGlgIBAzCCBlAGCSqGSIb3DQEHAaCCBkEEggY9MIIGOTCCAe4GCSqGSIb3DQEHAaCCAd8EggHb'+
'MIIB1zCCAdMGCyqGSIb3DQEMCgECoIIBgjCCAX4wKAYKKoZIhvcNAQwBAzAaBBSaUMlXnxjzpfdu'+
'6YFwZgJFMklDWFyvCnQeuZpN2E+Rb4rf9MkJ6FsmPDA9MCEwCQYFKw4DAhoFAAQU4ZKBfaXcN45w'+
'9hYm215CcA4n4d0EFJL8jr68wwKwFsVckbjyBz/zYHO6AgIEAA==';

// Password for the keystore
stub.clientCertPasswd_x = 'passwd';

String input = 'This is the input string';
String output = stub.EchoString(input);

The new, improved method is to use the clientCertName_x field:

docSample.DocSamplePort stub = new docSample.DocSamplePort();
stub.clientCertName_x = 'DocSampleCert';
String input = 'This is the input string';
String output = stub.EchoString(input);

It's likely that the certificate was installed incorrectly in the third-party system. Without knowing more, it's difficult to say what went wrong, but it's probably safe to assume that the problem is on the far end, and not with your Salesforce configuration or Apex Code.

  • Hi sfdcfox, Thanks for your response, We are using self signed certificate. You mean at the time of importing certificate at third party end system will ask password and import certificate and same password is need to be password from salesforce side. Please help us this is import for us. – Prakash Nawale Dec 4 '17 at 2:43
  • @PrakashNawale Are you using the cert+password or the name, though? If you're using the cert+password, it should be the cert+password from the foreign system, while if it's the name attribute, you need to take the certificate and put it in the other system. They need to agree with each other. – sfdcfox Dec 4 '17 at 4:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.