Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Interceptorchains to JAX WS Provider

I know I can add handlers(JAX WS) to an SEI using @HandlerChain I know I can add interceptors(Apache CXF) to an SEI like this - http://web-gmazza.rhcloud.com/blog/entry/jaxwshandlers-to-cxfinterceptors

I know I can add handlers to the Provider Interface using @HandlerChain- https://docs.oracle.com/middleware/1213/wls/WSGET/jax-ws-soaphandlers.htm#WSGET3461

Question is : Can I, and if so How,(the same way as SEI?) add Interceptors to the Provider interface?

like image 972
Aneesh Barthakur Avatar asked Dec 13 '25 22:12

Aneesh Barthakur


1 Answers

Well, I figured out the answer to this specific question. You can add interceptors like this

ProviderImpl implementor = new ProviderImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setAddress("http://localhost:9000/providerexample");
svrFactory.setServiceBean(implementor);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
svrFactory.create();

But now the next problem : interceptors deal with SoapMessage(Apache CXF). Provider deals with SOAPMessage(JAXWS). So I can get the interceptors to log and all, but when I try to manipulate the SoapMessage, I have troubles. Still not sure if the reason is the incompatibility of these two classes( or whether the framework takes care of the interconversion) or the specific code I'm using there.

EDIT: There is no problem with the Interceptors, it was just some stupid errors I made.

like image 130
Aneesh Barthakur Avatar answered Dec 15 '25 12:12

Aneesh Barthakur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!