The easiest way is as follows: Say your web service is called MyWebService. Implement the class that does the real work as a singleton class (i.e. private constructor, public getInstance() method which returns the only instance of the singleton class, creating it if it doesn't exist). This class will be called something like MyWebServiceImpl. Your servant class will be a wrapper around the methods in MyWebServiceImpl. For example, say you expose a method called x, the code in the servant class will call MyWebServiceImpl().getInstance().x().
Create a servlet for lifecycle management. In your web.xml set the "loadOnStartup" value to 1. In your servlet's init() method call MyWebServiceImpl.getInstance() and do your necessary initializing in the getInstance() method. In your servlet's destroy() method, call something like MyWebServiceImpl.getInstance().shutdown() to clean up (assuming that you've defined a shutdown() method). Your lifecycle management servlet can do other stuff - for example acting as the destination for post operations from any admin pages that you might write. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
