3

Please enlighten me\correct me on following point:

When we expose our class as SOAP Web service, End User consumes

  1. Enterprise/Partner WADL

  2. Class's generated WSDL

and then post request to our Salesforce Org and we process the request in method and send back the response.

Question is that,

  1. If we change the parameters used in webservice method in our org., will this cause error at end user consuming old WSDL?

  2. What if one user is using old version of class WSDL and other is using updated version of class WSDL. Will this cause error in any case?

  3. Are webservice method parameter's (which results in tags WSDL XML) are mandatory? What if we remove any one of the tag in request and post call to Salesforce Org., will this cause an error?

3
  1. Yes, Some WSDL has strictly typed XML validators, you change a single thing and hell break loose.
  2. It will break as it won't find the exact match for a method with exact parameters, it would just break
  3. Refer Point 2.

Thus you have to share your Updated WSDL with the third party everytime you change your parms.

Is there a hack for this?

Yes there is.

Build your webservice in such a way that it accepts List of Objects. By this mechanism, you dont have to change the updated WSDL everytime to thrirdparty.

global class MyWebService {
    webservice static Id makeContact(List<Object> params) {

    }
}
| improve this answer | |
  • Hi Pranay, I tried above mentioned scenarios and it is working for Old WSDL ,even if i have updated the parameters. Do you have any idea about this? Let me know if i am missing on anything. – sfdcnoob Jun 1 '18 at 8:19
  • I have updated it as "Some WSDL", so its not uniform all around. Some API's will break, some might just handle it. There is no guarentee,# – Pranay Jaiswal Jun 1 '18 at 8:21
  • Hi Pranay, For the approach "Build your web service in such a way that it accepts List of Objects.", i have tried but just need confirmation that, the sequence maintained in input XML Request file and Paramaters list retrieved in APEX are same ? – sfdcnoob Jun 1 '18 at 11:21
  • 1
    @sfdcnoob the generated WSDL uses xsd: Sequence. And according to definition."The sequence element specifies that the child elements must appear in a sequence.". w3schools.com/xml/el_sequence.asp – Pranay Jaiswal Jun 1 '18 at 12:59
2

Yes you need to share updated WSDL with them if you change parameter in method. Users with old WSDL will not be able to use it.

If you change anything inside method body this will not affect them.

Normally when I create a WSDL I use a Wrapper class instance to pass in parameter and whenever I need a new parameter I just add that in wrapper class. So All users using old version will not get affected.

| improve this answer | |
  • Hi Tushar, I tried above mentioned scenarios and it is working for Old WSDL ,even if i have updated the parameters. Do you have any idea about this? Let me know if i am missing on anything. – sfdcnoob Jun 1 '18 at 8:17
  • @sfdcnoob did you change the class version when updating the WSDL? if not then might chances that Salesforce provide support for backward compatibly. – Tushar Sharma Jun 1 '18 at 8:29
  • Yes I also tried with changing the version of class. I have tried most of the permutations and it is working. But I have tested all of the scenarios with API Testing Tool. – sfdcnoob Jun 1 '18 at 10:52
  • @sfdcnoob so it looks like a no guarantee case. I will try to find some docs here and will update you once I found any. – Tushar Sharma Jun 1 '18 at 11:24

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.