-
Task
-
Resolution: Unresolved
-
Optional
-
None
-
31.0.1.Final
-
None
-
---
-
---
This is low priority task to research if this is possible for webservice pojo endpoint to support the CDI interceptor without InterceptorBinding.
public class POJOInterceptorImpl { @AroundInvoke public Object intercept(final InvocationContext ic) throws Exception { return ic.proceed(); } }
@WebService(name = "POJOEndpoint", serviceName = "POJOEndpointService", targetNamespace = "http://org.jboss.test.ws/jbws3441") public class POJOEndpointImpl implements EndpointIface { @Interceptors({ POJOInterceptorImpl.class }) public String echo(final String message) { return message + " interceptor called ; } }
When this PojoInterceptorImpl is added to POJOEndpointImpl. This interceptor is called twice. The first time is called by the ManagedReferenceLifecycleMethodInterceptor and another time is called by Weld interceptor. This isn't expected. We can look at if it's possible that webservice can support to handle this .
The workaround/solution is for this to clearly declare this is CDI interceptor with InterceptorBinding and enable this interceptor in beans.xml.
The same interceptor(without interceptor binding) annotated for a EJB ws endpoint works. EJB container called this only once.
To reproduce this issue, download the attached test case and copy to target WFLY source directory
testsuite/integration/ws/src/test/java/org/jboss/as/test/integration/ws/cdi/intercepor
Then under testsuite/integration/ws directory, run
mvn clean install -Dtest=InterceptorCalledTwiceTestCase
This test is failed with failure:
InterceptorCalledTwiceTestCase.testPojoCall:55 expected:<...erceptor called for [1] times> but was:<...erceptor called for [2] times>