CDI provides a way of doing method interception. This works for POJOs and EJBs. For more information, see the CDI 1.0 specification from here: http://jcp.org/en/jsr/detail?id=299. Page 74 of the PDF (printed page number 67) specifies the interceptor features.
Here's an example of how I would have expected this to work with a JAX-WS service implemented as a POJO rather than an EJB: https://github.com/weld/core/pull/154/files
This does not work in JBossWS. See Richard Opalka's comment:
I reviewed the test case and I confirm it won't work.
CDI interceptors won't work on JAXWS POJOs because of current design.
The reason is JAXWS POJO invocation is not using AS7 interceptor chains at all.
It just reuses AS7 component instances (to see injections).
CDI @Inject does work. I'm not sure about other CDI features.
I am creating a framework that provides annotation support for transactional Web services. I am using CDI to implement this. My motivation for this feature is that I want to fully support JAX-WS. Currently my users must implement their Web services as EJBs for my annotations to work. With CDI and JEE6, the movement seems to be away from EJB and towards POJOs. Therefore, I would expect more JBossWS users to take the POJO approach, rather than the EJB approach. I'm sure you guys would have a better idea than I have, so please let me know what you think.
|Rewrite JAXWS POJO invocation process