2 Replies Latest reply on Jul 29, 2008 5:15 AM by adinn

    Use of PostCreate in JaxWS WebService implementation class

    adinn

      JSR 109 appears (to me at least) to suggest that the @PostCreate and @PreDestroy annotations can be used to annotate lifecycle methods of either an EJB or a POJO, so long as the EJB/POJO is tagged with a WebService annotation. Here is the relevant text from version 1.2


      5.3.2.4.2.1 The optional @PostConstruct or @PreDestroy annotations
      A Service Implementation Bean may use javax.annotation.PostConstruct or javax.annotation.PreDestroy annotation on methods for lifecycle event callbacks. The methods annotated with javax.annotation.PostConstruct or javax.annotation.PreDestroy annotation allow the web container to notify a Service Implementation Bean instance of impending changes in its state. The bean may use the notification to prepare its internal state for the transition. If the bean implements methods that are annotated with javax.annotation.PostConstruct or javax.annotation.PreDestroy annotations then the container is required to call them in the manner described below.
      . . .


      This is all subsumed under section 5.3.2.4 'Web container programming model' and is distinct from the case described in section 5.2.3.3 'EJB container programming model' which is why I take it to be referring to use of POJOs annotated with @WebService.

      I tried to use this feature in a service implementation class running under JBossWS Native 3.0.2 on AS 5.0.0.CR1 and the life cycle methods were not invoked. Is this because

      I am reading JSR 109 wrong
      I am reading JSR 109 correct but JBossWS Native 3.0.2 does not (yet) implement lifecycle methods
      I am reading JSR 109 correct and JBossWS Native 3.0.2 does implement lifecycle methods but there is a bug
      small print may apply

      Any clarification would be most gratefully received