4

We have completely changed the way a managed package operates and no longer want a legacy global webservice method. I don't want it to be included in future packages/installs. However, I can't seem to figure out how to do this. Is this even possible?

I know I can't simply delete the class because it is a global class, so I attempted to use the @deprecated annotation, as indicated by the documentation:

Use the deprecated annotation to identify methods, classes, exceptions, enums, interfaces, or variables that can no longer be referenced in subsequent releases of the managed package in which they reside. This is useful when you are refactoring code in managed packages as the requirements evolve. New subscribers cannot see the deprecated elements, while the elements continue to function for existing subscribers and API integrations.

Alas this fails to work, and I receive the following error messages:

  • Defining type for webService methods cannot be Deprecated
    (when I put the annotation on the enclosing class)
  • webService methods cannot be Deprecated
    (when I put the annotation directly on the method)

A quick look to the WebService documentation turned up this info:

You cannot deprecate webService methods or variables in managed package code.

But that is all I was able to find. No indication on how I could remove/deprecate a webservice method.

Does anyone know of a way to remove a webservice method from a managed package !?

4

AFAIK you will have to leave the class/method there and just document somewhere that it should no longer be used. But bear in mind one or more of your customers may be using it without your knowledge.

If you are sure no customer is using it, you can empty the class out and just throw an exception if it is ever called in the future.

(While leaving something like this in your code is uncomfortable, you may well find that this will not be the last time that you have to do that sort of thing due to the uncompromising versioning model of the platform.)

  • "uncomfortable" is a good word for it. – pirate-matt Aug 9 '17 at 15:44

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.