Search code examples
salesforce

Salesforce integration not does not update changes


When I give my Salesforce partner an API to make product imports to Salesforce, but every time I modify this API my partner tells me that Salesforce doesn't know about the changes and I have to rename the service so he can register it again.

I have no idea about Salesforce.

I have tried to make calls to my API with other consumers and it works ok.


Solution

  • Your colleague makes life harder for himself by using SOAP and WSDL.

    Converting to REST API and JSON is bit of a jump but there are similar generators of service stubs, for example https://json2apex.herokuapp.com/. You feed it the sample JSON and it generates nice structure + parsing code...

    But anyway. Yes, often in order to "see" the changes like new fields or methods we need to regenerate the code ("consume" the WSDL) again.

    1. He could run the code generation in another org. A sandbox where problematic classes are deleted. A fresh Developer Edition or Trailhead playground org. An empty scratch org that'll be immediately deleted. I mean... it's not like you can do it straight to production anyway, you still need a deployment step. Generate it in a throwaway org, copy paste the code to a proper sandbox if you need testing, deploy to prod.

    2. He could run the wsdl2apex tool standalone on disk without SF complaining about duplicate classes. Bit more effort to set it up but reward could be 1-click automation to download fresh wsdl from your server, generate, deploy to sandbox... Depends how often you do it.

    3. He could choose a silly name for the class every time he generates. Who's going to stop me from generating SparklyFashionableUnicorn class, examining the generated code, doing mass search-replace to put the original service's name in. Overwrite original class with new content, delete the unicorn, job done.

    enter image description here