Is there any process where we can generate apex code whenever the WSDL changes such that changes in the WSDL can be added/updated to the Apex class/classes in a generic way such that we do not have to manually generate and add the inner class or variables in the apex class?


No, not in any meaningful way using WSDL2Apex. For instance, if something is added to the XML response then it needs to have the corresponding member in the class that represents the response. WebserviceCallout.invoke will raise an error otherwise.

The only way I can think of to adapt is to create the raw HTTP Requests and parse the SOAP response in Apex yourself.

I've found it more productive to try and increase the abilities of WSDL2Apex so that it can automatically create the inner classes with the required attributes. Then you can just rerun the tooling whenever the WSDL changes.

You can also do this yourself with the open source version of WSDL2Apex.

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.