On Wednesday 19 November 2008 5:48:40 pm Aaron Mulder wrote:
> Ah, well, I did finally find the jaxws:handlers element, which lets me
> hook in the JAX-WS handler class.  So that's working now.  Whew!

Well, using a JAX-WS handler would certainly work, there will be a performance 
penalty for doing so.   Usually around 20% or so as it breaks streaming.   I 
would definitely suggest trying to get the interceptor way working as that 
would allow the streaming to continue working properly.

> Interestingly, it seems to be called *after* the CXF interceptors.
> But I guess that's OK.

Well, that depends on the phase of the interceptor.   The JAX-WS handlers run 
in the PRE_PROTOCOL phase.   Thus, interceptors configured in earlier phases 
run before it, those configured after it run after it.   Just depends on 
where the interceptor is set to run.

Keep in mind, in CXF EVERYTHING is done via interceptors.   The runtime is 
litterally just a "for loop" that iterates over interceptors.   The events 
that happen just depend on where in the chain the interceptors are configured 
to run.

Dan



>
> Next question: Is there any way to insert a handler/interceptor before
> the JAXB marshalling/unmarshalling is done?
>
> Thanks,
>       Aaron
>
> On Wed, Nov 19, 2008 at 5:26 PM, Aaron Mulder
>
> <[EMAIL PROTECTED]> wrote:
> > I'm using a Spring (2.5.6) CXF (2.1.3) service set up with something like
> > this:
> >
> >    <jaxws:endpoint
> >            id="soapService"
> >            implementor="#myService"
> >            address="/MyService" />
> >
> > I'd like to add a filter/interceptor/handler to read some arbitrary
> > SOAP headers and decide whether to let the processing continue.  The
> > WSDL/Schema for the service is ignorant of these headers and their
> > associated data types.
> >
> > I first tried to add a CXF interceptor like this:
> >
> >    <jaxws:endpoint
> >            id="soapService"
> >            implementor="#myService"
> >            address="/MyService">
> >        <jaxws:inInterceptors>
> >            <ref bean="testSoapInterceptor" />
> >        </jaxws:inInterceptors>
> >   </jaxws:endpoint>
> >
> > But this interceptor sees NO headers at all (it gets an empty list
> > from SoapMessage.getHeaders()).  I wonder if that's because they're
> > not in the schema so JAXB doesn't know how to decode them?
> >
> > Anyway, then I tried adding a JAX-WS handler.  I marked up my service
> > implementation bean like this:
> >
> > @HandlerChain(file="soapHandlers.xml")
> > public class MyServiceImpl implements MyService {
> > ...
> >
> > Then I created a soapHandlers.xml in the same package directory as that
> > class:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee";>
> >    <jws:handler-chain>
> >        <jws:handler>
> >           
> > <jws:handler-class>sample.soap.ServerHandler</jws:handler-class>
> > </jws:handler>
> >    </jws:handler-chain>
> > </jws:handler-chains>
> >
> > But this just seems to be ignored.  At runtime I get no messages about
> > the JAX-WS handler being created or applied, and I get no output from
> > the hander's handleMessage method at all.
> >
> > I'm running out of ideas.  What's the best way to do this?
> >
> > Thanks,
> >      Aaron



-- 
Daniel Kulp
[EMAIL PROTECTED]
http://dankulp.com/blog

Reply via email to