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 !?

1 Answer 1


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.)

  • 1
    "uncomfortable" is a good word for it.
    – piratematt
    Aug 9, 2017 at 15:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .