On Thursday, June 16, 2011 11:38:24 PM Gunnar Morling wrote:
> > JAX-WS handlers are designed for cross-web stack portability, so you can
> > move your web service to Metro or Spring WS without coding change.
> >  Since
> > portability is not a concern, by virtue of the fact that it would be
> > desired to attach the handlers via a CXF-specific bus,  the developer
> > will usually (always?) want to use interceptors instead
> > (http://www.jroller.com/gmazza/entry/jaxwshandlers_to_cxfinterceptors),
> > as they're normally faster.
> 
> Hmmm, I agree on that such a *configuration* would be CXF-specific.
> But the actual handlers would still be portable between JAX-WS
> implementations.
> 
> So IMO allowing a CXF-specific global configuration of per se portable
> handlers would be beneficial for scenarios, where common handlers are
> configured for all endpoints. When migrating to another stack the
> handlers could remain unchanged, only the configuration would have to
> be adapted (which it has to be anyways, as e.g. Metro naturally
> couldn't handle CXF's Spring configuration).
> 
> Performance is another story, though. Do you have any numbers how much
> faster interceptors are than handlers?

It really depends on the what you are doing in your service.    If you already 
have a need for the SAAJ stuff (for example: ws-security) for your service, 
then the incremental performance cost is very small.   The cost of producing 
the DOM/SAAJ model is already required.   However, if you aren't doing 
something that needs the SAAJ, the performance cost  really depends on a bunch 
of factors:

1) Version of CXF:  2.4.x and recent 2.3.x do a good job of caching the SAAJ 
factories and such which reduced a lot of contention.    

2) Size of messages:  since SAAJ requires the full model in memory, smaller 
messages don't take much of a hit compared to large messages.   

3) Content of the messages:  if the content is mostly string content, I think 
the impacts is slightly less than things like integers and such where new 
string need to be allocated in memory and held onto.   

4) likely others....

For the most part, it's generally around 10-15% slower with the handlers in 
place, plus whatever cost of the handlers.


In anycase, the main issue is that with the JAX-WS handlers, the streaming of 
the messages is completely disabled for both incoming and outgoing messages as 
you cannot stick a handler on just one of those chains.    With the 
interceptors, you have a LOT more control.   If you need SAAJ, you COULD just 
enable it for incoming or outgoing and only take the hit on that direction.   
However, in many cases, with the interceptors, you can likely solve a lot of 
issues without breaking the streaming.    A lot of the header manipulation and 
such can be done without breaking the streaming.

Dan




> 
> --Gunnar
> 
> 2011/6/16 Glen Mazza <[email protected]>:
> > On 06/16/2011 03:31 AM, Dirk Rudolph wrote:
> >> Can you explain, what is the reason for configuring handler only per
> >> endpoint?
> >> Wouldn't it be a nice feature configuring them globally if necessary?
> > 
> > I guess it would be partly philosophical, partly due to lack of demand,
> > partly due to having such functionality added in being a potential
> > source of bugs.
> > 
> > What is a JAX-WS handler, *including* how you connect it to the web
> > service or client, is defined in the JAX-WS specification.  Arguably,
> > if you could connect it any other way than defined (such as with a CXF
> > bus) it wouldn't be a JAX-WS handler.  :)
> > 
> > JAX-WS handlers are designed for cross-web stack portability, so you can
> > move your web service to Metro or Spring WS without coding change.
> >  Since
> > portability is not a concern, by virtue of the fact that it would be
> > desired to attach the handlers via a CXF-specific bus,  the developer
> > will usually (always?) want to use interceptors instead
> > (http://www.jroller.com/gmazza/entry/jaxwshandlers_to_cxfinterceptors),
> > as they're normally faster.
> > 
> > Glen
> > 
> >> I also use one JAX-WS Handler in all my endpoints.
> >> 
> >> Thanks, Dirk
> >> 
> >> -----Ursprüngliche Nachricht-----
> >> Von: Willem Jiang [mailto:[email protected]]
> >> Gesendet: Donnerstag, 16. Juni 2011 06:13
> >> An: [email protected]
> >> Betreff: Re: Globally specifying JAX-WS handlers
> >> 
> >> No, JAX-WS handlers are configured per endpoint.
> >> 
> >> On 6/16/11 4:34 AM, Gunnar Morling wrote:
> >>> Hi,
> >>> 
> >>> according to the documentation [1] one can specify interceptors on
> >>> the
> >>> bus level, which will then be applied to all endpoints. Is the same
> >>> also possible for JAX-WS handlers?
> >>> 
> >>> Thanks, Gunnar
> >>> 
> >>> [1] http://cxf.apache.org/docs/bus-configuration.html
> > 
> > --
> > Glen Mazza
> > Software Engineer, Talend (http://www.talend.com)
> > blog: http://www.jroller.com/gmazza
-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com

Reply via email to