users@jax-rpc.java.net

Re: JWSDP/S1Studio5: ServiceLifecycle.init() never invoked ?!?

From: Roderico Cruz <roderico.cruz_at_sun.com>
Date: Tue, 22 Jul 2003 16:43:44 -0700

Sorry for the late reply.

When a web service is "created in S1Studio, a servant is generated that delegates the call to the actual method.

This design was chosen to support the calling of multiple EJBs, multiple regular Java classes, as well as allow for other extensions in the future.
The generated servant figured out how to obtain the object from which to make the call.
For example, if the call was to an EJB, the appropriate JNDI call was made.

In short, your Java class is not seen by wscompile as the servant, so neither the init() or destroy() methods is called by the container.

That the destroy() method was called is accidental (and is a bug) that is related to our facility for creating "conversational" web services.

Thanks.
Rico

Gero Vermaas wrote:

> Hi,
>
> I received a question from a customer with regard to the javax.xml.rpc.server.ServiceLifecycle interface. The customer is using SunOneStudio 5 and SunOneAppServer 7 to gain experience with webservice developement.
>
> They implemented the javax.xml.rpc.server.ServiceLifecycle interface, generated a (web-centric) webservice and test client using SunOneStudio 5, and deployed it on SunOneAppserver 7. The problem now is that the init() method that they've implemented for the ServiceLifecycle never get's invoked. The strange thing is that the destroy() method (also of ServiceLifecycle) does get invoked when they invoke the webservice :-(
>
> I tried the same thing and ran into the same problem. Reading the API doc at http://java.sun.com/webservices/docs/1.2/api/javax/xml/rpc/server/ServiceLifecycle.html suggests that both init() and destroy() should be invoked. I also deployed the thing to the internal Tomcat server of SunOneStudio5 and then even the destroy() method was not invoked anymore.
>
> I've zipped up the small test project, you can download it at: http://www.xs4all.nl/~gero/servicelifecycleproblem.zip
>
> The class for which a webservice is generated is attached: TestjeImpl.java.
>
> When the WebService is invoked, it porduces the following in the server.log file of SunOneAppServer:
> [15/Jul/2003:15:22:43] INFO (32005): CORE3282: stdout: ------------------------------
> [15/Jul/2003:15:22:43] INFO (32005): CORE3282: stdout: Test webservice constructor
> [15/Jul/2003:15:22:43] INFO (32005): CORE3282: stdout: ------------------------------
> [15/Jul/2003:15:22:43] INFO (32005): CORE3282: stdout: do echo for value 1234
> [15/Jul/2003:15:22:43] INFO (32005): CORE3282: stdout: ------------------------------
> [15/Jul/2003:15:22:43] INFO (32005): CORE3282: stdout: Test webservice is destroyed!
> [15/Jul/2003:15:22:43] INFO (32005): CORE3282: stdout: beenThere: false
> [15/Jul/2003:15:22:43] INFO (32005): CORE3282: stdout: ------------------------------
>
> Any idea why the destroy() method does get invoked and the init() not?
>
> Regards,
>
> Gero
>
> ------------------------------------------------------------------------
> Name: TestjeImpl.java
> TestjeImpl.java Type: Java File (application/x-unknown-content-type-javafile_se)
> Encoding: base64
>
> Name: TestjeIF.java
> TestjeIF.java Type: Java File (application/x-unknown-content-type-javafile_se)
> Encoding: base64

--
Rico Cruz
Sun Microsystems
510 869-2045