What do you mean by starting/stopping?
There are several possible meanings of this:
This depends on the server in which you run the web service. GlassFish v3, for instance, exposes a RESTful service allowing for programmatic management. See: http://weblogs.java.net/blog/arungupta/archive/2009/08/totd_96_glassfi.html - Process requests/ignore requests.
See alternative below.
- Accept requests/not accept requests.
The last two alternatives can be accomplished in the web service by exposing some kind of control operation or JMX bean that allows for turning the service on or off.
For instance, if the flag is set to true then requests are processed in a normal fashion. If the flag is set to false, then requests may be ignored or a fault may even be returned as the result of a request to the service when it is in a mode not to accept requests.