You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by gjanjana <gj...@yahoo.com> on 2007/12/11 00:02:59 UTC

Configuring JAX-WS Handler in spring configuration file


I was trying to configure JAX-WS Handler as part of spring configuration
file. I don't find any means to do that. Is it possible to register JAX-WS
Handler at deploy time instead of using @HandlerChain annotation. I don't
want every java class to declare this handler chain. 

For example following descriptor markup registers jaxws service endpoint.
This element accept CXF interceptors as part of "jaxws:inInterceptors"
element. However I don't find any way to register JAX-WS Handlers. 

<jaxws:endpoint id="classImpl"
    implementor="org.apache.cxf.jaxws.service.Hello"
    endpointName="e:HelloEndpointCustomized"
    serviceName="s:HelloServiceCustomized"
    address="http://localhost:8080/test"
    xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"
    xmlns:s="http://service.jaxws.cxf.apache.org/service"/>
</beans>
-- 
View this message in context: http://www.nabble.com/Configuring-JAX-WS-Handler-in-spring-configuration-file-tp14263725p14263725.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Configuring JAX-WS Handler in spring configuration file

Posted by Daniel Kulp <dk...@apache.org>.
I just answered this for someone else as well...  :-)


Currently, no.   It looks like it was started as the HandlerChainBuilder 
has a "buildHandlerChainFromConfiguration" method, but it's only called 
from various unit tests right now.   It's not wired into the spring 
loading at all.   That would be a good feature request.  

Dan



On Monday 10 December 2007, gjanjana wrote:
> I was trying to configure JAX-WS Handler as part of spring
> configuration file. I don't find any means to do that. Is it possible
> to register JAX-WS Handler at deploy time instead of using
> @HandlerChain annotation. I don't want every java class to declare
> this handler chain.
>
> For example following descriptor markup registers jaxws service
> endpoint. This element accept CXF interceptors as part of
> "jaxws:inInterceptors" element. However I don't find any way to
> register JAX-WS Handlers.
>
> <jaxws:endpoint id="classImpl"
>     implementor="org.apache.cxf.jaxws.service.Hello"
>     endpointName="e:HelloEndpointCustomized"
>     serviceName="s:HelloServiceCustomized"
>     address="http://localhost:8080/test"
>     xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"
>     xmlns:s="http://service.jaxws.cxf.apache.org/service"/>
> </beans>



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

RE: Configuring JAX-WS Handler in spring configuration file

Posted by "Liu, Jervis" <jl...@iona.com>.

> -----Original Message-----
> From: Liu, Jervis [mailto:jliu@iona.com]
> Sent: 2007年12月11日 10:48
> To: cxf-user@incubator.apache.org
> Subject: RE: Configuring JAX-WS Handler in spring configuration file
> 
> There is a standard way to configure JAX-WS handlers using configuration
> files, please refer to the jaxws_handlers demo
> (jaxws_handlers\src\demo\handlers\common\demo_handlers.xml) shipped
> with CXF distribution. The lifecycle of JAX-WS handlers has to be handled by
> JAX-WS runtime, not by anything outside. javax.annotation.Resource
> annotation can be used if you wish to perform any injection.
> 
[Liu, Jervis] 
Correct myself. The lifecycle of JAX-WS handlers can be handled by applications. AX-WS 2.0 spec 9.3.1:

"9.3.1 Handler Lifecycle 
In some cases, a JAX-WS implementation must instantiate handler classes directly, e.g. in a container 
environment or when using the HandlerChain annotation. When doing so, an implementation must invoke 
the handler lifecycle methods as prescribed in this section. 

If an application does its own instantiation of handlers, e.g. using a handler resolver, then the burden of
calling any handler lifecycle methods falls on the application itself. This should not be seen as inconsistent, 
because handlers are logically part of the application, so their contract will be known to the application 
developer."

To load JAX-WS handlers from Spring, on the client side, this can be done through JAX-WS HandlerResolver. Implement your own HandlerResolver that can load handlers using spring context, then call javax.xml.ws.Service.setHandlerResolver(HandlerResolver). However this HandlerResolver API only exists on the client side. Another way that can be applied to both client and server side is through javax.xml.ws.Binding.setHandlerChain(java.util.List<javax.xml.ws.handler.Handler> chain) method. This requires some enhancement to CXF so that the setting of handlers configured in spring file is delegated to javax.xml.ws.Binding.setHandlerChain(). 

Jervis
> Cheers,
> Jervis
> 
> 
> > -----Original Message-----
> > From: gjanjana [mailto:gjanjana@yahoo.com]
> > Sent: 2007年12月11日 7:03
> > To: cxf-user@incubator.apache.org
> > Subject: Configuring JAX-WS Handler in spring configuration file
> >
> >
> >
> > I was trying to configure JAX-WS Handler as part of spring configuration
> > file. I don't find any means to do that. Is it possible to register JAX-WS
> > Handler at deploy time instead of using @HandlerChain annotation. I don't
> > want every java class to declare this handler chain.
> >
> > For example following descriptor markup registers jaxws service endpoint.
> > This element accept CXF interceptors as part of "jaxws:inInterceptors"
> > element. However I don't find any way to register JAX-WS Handlers.
> >
> > <jaxws:endpoint id="classImpl"
> >     implementor="org.apache.cxf.jaxws.service.Hello"
> >     endpointName="e:HelloEndpointCustomized"
> >     serviceName="s:HelloServiceCustomized"
> >     address="http://localhost:8080/test"
> >     xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"
> >     xmlns:s="http://service.jaxws.cxf.apache.org/service"/>
> > </beans>
> > --
> > View this message in context:
> >
> http://www.nabble.com/Configuring-JAX-WS-Handler-in-spring-configuratio
> > n-file-tp14263725p14263725.html
> > Sent from the cxf-user mailing list archive at Nabble.com.
> 
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

RE: Configuring JAX-WS Handler in spring configuration file

Posted by "Liu, Jervis" <jl...@iona.com>.
There is a standard way to configure JAX-WS handlers using configuration files, please refer to the jaxws_handlers demo (jaxws_handlers\src\demo\handlers\common\demo_handlers.xml) shipped with CXF distribution. The lifecycle of JAX-WS handlers has to be handled by JAX-WS runtime, not by anything outside. javax.annotation.Resource annotation can be used if you wish to perform any injection.

Cheers,
Jervis


> -----Original Message-----
> From: gjanjana [mailto:gjanjana@yahoo.com]
> Sent: 2007年12月11日 7:03
> To: cxf-user@incubator.apache.org
> Subject: Configuring JAX-WS Handler in spring configuration file
> 
> 
> 
> I was trying to configure JAX-WS Handler as part of spring configuration
> file. I don't find any means to do that. Is it possible to register JAX-WS
> Handler at deploy time instead of using @HandlerChain annotation. I don't
> want every java class to declare this handler chain.
> 
> For example following descriptor markup registers jaxws service endpoint.
> This element accept CXF interceptors as part of "jaxws:inInterceptors"
> element. However I don't find any way to register JAX-WS Handlers.
> 
> <jaxws:endpoint id="classImpl"
>     implementor="org.apache.cxf.jaxws.service.Hello"
>     endpointName="e:HelloEndpointCustomized"
>     serviceName="s:HelloServiceCustomized"
>     address="http://localhost:8080/test"
>     xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"
>     xmlns:s="http://service.jaxws.cxf.apache.org/service"/>
> </beans>
> --
> View this message in context:
> http://www.nabble.com/Configuring-JAX-WS-Handler-in-spring-configuratio
> n-file-tp14263725p14263725.html
> Sent from the cxf-user mailing list archive at Nabble.com.

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland