12.07.2015 Views

Beginning Java EE 6 with GlassFish 3, Second Edition

Beginning Java EE 6 with GlassFish 3, Second Edition

Beginning Java EE 6 with GlassFish 3, Second Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 14 ■ SOAP WEB SERVICESLife Cycle and CallbackWeb services also have a life cycle that resembles the stateless and message-driven bean, as you can seein Figure 14-5. It is the same life cycle found for components that do not hold any state: either they donot exist or they are ready to process a request. This life cycle is managed by the container.Figure 14-5. Web service life cycleBoth the servlet and EJB endpoint support dependency injection (because they run in a container)and life-cycle methods such as @PostConstruct and @PreDestroy. The container calls the @PostConstructcallback method, if any, when it creates an instance of a web service, and calls the @PreDestroy callbackwhen it destroys it.One difference between servlet and EJB endpoints is that EJBs can use interceptors. Interceptors arethe <strong>Java</strong> <strong>EE</strong> implementation of the Aspect-Oriented Programming (AOP) concept described in Chapter 8.439

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!