Excellent! That should work fine. -dh
-----Original Message----- From: Grossberger, Guenter [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 13, 2005 11:25 AM To: [email protected] Subject: RE: Axis - setup/teardown notification? Hi! You can derive your own servlet class from AxisServlet and implement your own init method that initializes your service if you have some static initialization (don't forget to call super.init()). In web.xml put your class in the <servlet-class> instead of AxisServlet and make sure you have a positive value in <load-on-startup>. Then your servlet (and your initialization) is initialized at startup of the server. In session mode a new service object is created for every session so you can place a per object initialization in the constructor (or better in a private init method that is called by the constructor). Best regards, Günter > -----Original Message----- > From: Dave Hoffer [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 13, 2005 5:14 PM > To: [email protected] > Subject: RE: Axis - setup/teardown notification? > > Yes, this is exactly what I had in mind. Thanks for the help on this. > > ...couple of clarifications, is there any way for the init > method to be > called by Axis at startup instead of the client? Our web service is a > daemon and I would like the init to be called when the system boots > rather than at the first client call. > > Thanks much! > > -dh > > -----Original Message----- > From: Juha Kononen [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 13, 2005 11:01 AM > To: [email protected] > Subject: Re: Axis - setup/teardown notification? > > I'm not sure are we talking about the same thing, > but I suggest you implement, for example, an 'init' method, > in addition > to your service method. > Put all your initialization code in the init method as well as the > initialization message that you are going to > send back to a client. Then invoke your web service with the init > method instead of the service method. > Now you have initialized your web service before its use and you have > got the initialization message. > I recommend to use the session mechanism, because then Axis creates > only one service object per a client > and reuses the service object for the length of the session. Without > the session Axis creates and destroys your > service object every time you call it. > > However, when you want to make some cleanup before the destruction of > the service object, you > can do it by implementing the destroy method from the > javax.xml.rpc.server.ServiceLifecycle interface in your > service object. > The Axis engine calls destroy() either at shutdown, when a session > expires, or at the end of a request. > You may try to put a message in the destroy method and check whether > you get it from the server, but I'm not sure does > it work because I haven't test it. > > Juha > > > >>> [EMAIL PROTECTED] 09/13 4:13 >>> > Does Axis provide any mechanism to notify web services that they are > starting and/or stopping? I would like to provide some resource > initialization when my web service has started and provide some > resource > cleanup when it is being stopped for any reason. > > > > What is the preferred way to do this? > > > > -dh > >
