JAX-WS handler attachment options within Apache CXF

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

JAX-WS handler attachment options within Apache CXF

Glen Mazza-2
Hello,

The JAX-WS specification--as well as our jax-ws handler
sample[1]--specify/show two ways to attach a JAX-WS handler to a CXF
client or service:

1.) For the service, configuration via annotations and an XML file
(e.g., under /commons in [1]).

2.) For the client, programmatically within the Java class making the
web service call.

Question:  Does anyone know of additional ways one can attach a JAX-WS
handler to the web service or client?  For example, can I
programmatically attach handlers to the web service implementation, or
do XML configuration of handler chains on the *client* side?

Thanks,
Glen

[1] http://tinyurl.com/2ps3y2


Reply | Threaded
Open this post in threaded view
|

Re: JAX-WS handler attachment options within Apache CXF

James Mao
Glen,

The answer is YES, you can do it programmatically

Service side API

Endpoint.getBinding().setHandlerChain(List<Handler>)


Client side API

BindingProvider.getBinding().setHandlerChain(List<Handler>)

Besides, the Service API

Service.setHandlerResolver()

Hope it helps,
James

> Hello,
>
> The JAX-WS specification--as well as our jax-ws handler
> sample[1]--specify/show two ways to attach a JAX-WS handler to a CXF
> client or service:
>
> 1.) For the service, configuration via annotations and an XML file
> (e.g., under /commons in [1]).
>
> 2.) For the client, programmatically within the Java class making the
> web service call.
>
> Question:  Does anyone know of additional ways one can attach a JAX-WS
> handler to the web service or client?  For example, can I
> programmatically attach handlers to the web service implementation, or
> do XML configuration of handler chains on the *client* side?
>
> Thanks,
> Glen
>
> [1] http://tinyurl.com/2ps3y2
>
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: JAX-WS handler attachment options within Apache CXF

James Mao
Probably this way is safer

getBinding().getHandlerChain().add(YourHandler)

James

> Glen,
>
> The answer is YES, you can do it programmatically
>
> Service side API
>
> Endpoint.getBinding().setHandlerChain(List<Handler>)
>
>
> Client side API
>
> BindingProvider.getBinding().setHandlerChain(List<Handler>)
>
> Besides, the Service API
>
> Service.setHandlerResolver()
>
> Hope it helps,
> James
>
>> Hello,
>>
>> The JAX-WS specification--as well as our jax-ws handler
>> sample[1]--specify/show two ways to attach a JAX-WS handler to a CXF
>> client or service:
>>
>> 1.) For the service, configuration via annotations and an XML file
>> (e.g., under /commons in [1]).
>>
>> 2.) For the client, programmatically within the Java class making the
>> web service call.
>>
>> Question:  Does anyone know of additional ways one can attach a JAX-WS
>> handler to the web service or client?  For example, can I
>> programmatically attach handlers to the web service implementation, or
>> do XML configuration of handler chains on the *client* side?
>>
>> Thanks,
>> Glen
>>
>> [1] http://tinyurl.com/2ps3y2
>>
>>
>>  
>
>
Reply | Threaded
Open this post in threaded view
|

Re: JAX-WS handler attachment options within Apache CXF

Willem.Jiang
For the server side, you may set the HandlerChain after the
endpoint.publish is called.

Willem.

James Mao wrote:

> Probably this way is safer
>
> getBinding().getHandlerChain().add(YourHandler)
>
> James
>
>> Glen,
>>
>> The answer is YES, you can do it programmatically
>>
>> Service side API
>>
>> Endpoint.getBinding().setHandlerChain(List<Handler>)
>>
>>
>> Client side API
>>
>> BindingProvider.getBinding().setHandlerChain(List<Handler>)
>>
>> Besides, the Service API
>>
>> Service.setHandlerResolver()
>>
>> Hope it helps,
>> James
>>
>>> Hello,
>>>
>>> The JAX-WS specification--as well as our jax-ws handler
>>> sample[1]--specify/show two ways to attach a JAX-WS handler to a CXF
>>> client or service:
>>>
>>> 1.) For the service, configuration via annotations and an XML file
>>> (e.g., under /commons in [1]).
>>>
>>> 2.) For the client, programmatically within the Java class making the
>>> web service call.
>>>
>>> Question:  Does anyone know of additional ways one can attach a JAX-WS
>>> handler to the web service or client?  For example, can I
>>> programmatically attach handlers to the web service implementation, or
>>> do XML configuration of handler chains on the *client* side?
>>>
>>> Thanks,
>>> Glen
>>>
>>> [1] http://tinyurl.com/2ps3y2
>>>
>>>
>>>  
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: JAX-WS handler attachment options within Apache CXF

Jim Ma-3
I also think we need to provide spring configuration for attaching
handler chain through
spring configuration .
I'd like to see there is api in JaxWsProxyFactoryBean,  EndpointImpl and
JaxwsServerFactoryBean that
we can configure the Handler with spring configuration, eg :

  <jaxws:endpoint id="addHandler"
implementor="org.apache.cxf.jaxws.service.Hello"
address="http://localhost:8080/test">
    <jaxws:handlers>
      <bean class="org.apache.cxf.LogHandler"/>
    </jaxws:handlers>
  </jaxws:endpoint>

Regards

Jim


Willem Jiang wrote:

> For the server side, you may set the HandlerChain after the
> endpoint.publish is called.
>
> Willem.
>
> James Mao wrote:
>> Probably this way is safer
>>
>> getBinding().getHandlerChain().add(YourHandler)
>>
>> James
>>
>>> Glen,
>>>
>>> The answer is YES, you can do it programmatically
>>>
>>> Service side API
>>>
>>> Endpoint.getBinding().setHandlerChain(List<Handler>)
>>>
>>>
>>> Client side API
>>>
>>> BindingProvider.getBinding().setHandlerChain(List<Handler>)
>>>
>>> Besides, the Service API
>>>
>>> Service.setHandlerResolver()
>>>
>>> Hope it helps,
>>> James
>>>
>>>> Hello,
>>>>
>>>> The JAX-WS specification--as well as our jax-ws handler
>>>> sample[1]--specify/show two ways to attach a JAX-WS handler to a CXF
>>>> client or service:
>>>>
>>>> 1.) For the service, configuration via annotations and an XML file
>>>> (e.g., under /commons in [1]).
>>>>
>>>> 2.) For the client, programmatically within the Java class making the
>>>> web service call.
>>>>
>>>> Question:  Does anyone know of additional ways one can attach a JAX-WS
>>>> handler to the web service or client?  For example, can I
>>>> programmatically attach handlers to the web service implementation, or
>>>> do XML configuration of handler chains on the *client* side?
>>>>
>>>> Thanks,
>>>> Glen
>>>>
>>>> [1] http://tinyurl.com/2ps3y2
>>>>
>>>>
>>>>  
>>>
>>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: JAX-WS handler attachment options within Apache CXF

Glen Mazza
Administrator
Jim Ma-3 wrote
I also think we need to provide spring configuration for attaching
handler chain through
spring configuration .
I'd like to see there is api in JaxWsProxyFactoryBean,  EndpointImpl and
JaxwsServerFactoryBean that
we can configure the Handler with spring configuration, eg :

  <jaxws:endpoint id="addHandler"
implementor="org.apache.cxf.jaxws.service.Hello"
address="http://localhost:8080/test">
    <jaxws:handlers>
      <bean class="org.apache.cxf.LogHandler"/>
    </jaxws:handlers>
  </jaxws:endpoint>

Regards
Jim
What about this example[1]:  Step(2)(a): customfile-server.xml?  Our example[2] just has <handler-chain> elements, but not the parent <jaxws:bindings> you see in [1]-- do we already support <jaxws:bindings/> in Spring config or cxf.xml, or is that just Metro-specific?  If <jaxws:bindings/> is a JAX-WS element we're not supporting yet, we may wish to implement this instead of a new <jaxws:handlers/> element that you're proposing.

Regards,
Glen

[1] http://blogs.sun.com/sdimilla/entry/implementing_handlers_using_jaxws_2
[2] http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_handlers/src/demo/handlers/common/demo_handlers.xml?revision=566980&view=markup
Reply | Threaded
Open this post in threaded view
|

Re: JAX-WS handler attachment options within Apache CXF

Glen Mazza
Administrator
In reply to this post by Willem.Jiang
OK, I see how you can programatically add handlers to a web service if you are using the manual endpoint.publish() method (similar to the first code block in "Logging Messages" in [1]) but what if you're creating an SEI implementation that runs with CXFServlet? (i.e., the MyWebServicePortTypeImpl in the second coded block in [1]) -- can you add code attaching the handler within an SEI implementation?  (No big deal if we can't, even the JAX-WS specification does not seem to support this.  I just want to make sure I know of all the options--I'll update our docs with this info.)

Thanks,
Glen

[1] http://cwiki.apache.org/CXF20DOC/debugging.html


willem.jiang wrote
For the server side, you may set the HandlerChain after the
endpoint.publish is called.

Willem.

James Mao wrote:
> Probably this way is safer
>
> getBinding().getHandlerChain().add(YourHandler)
>
> James
>
>> Glen,
>>
>> The answer is YES, you can do it programmatically
>>
>> Service side API
>>
>> Endpoint.getBinding().setHandlerChain(List<Handler>)
>>
>>
>> Client side API
>>
>> BindingProvider.getBinding().setHandlerChain(List<Handler>)
>>
>> Besides, the Service API
>>
>> Service.setHandlerResolver()
>>
>> Hope it helps,
>> James
>>
>>> Hello,
>>>
>>> The JAX-WS specification--as well as our jax-ws handler
>>> sample[1]--specify/show two ways to attach a JAX-WS handler to a CXF
>>> client or service:
>>>
>>> 1.) For the service, configuration via annotations and an XML file
>>> (e.g., under /commons in [1]).
>>>
>>> 2.) For the client, programmatically within the Java class making the
>>> web service call.
>>>
>>> Question:  Does anyone know of additional ways one can attach a JAX-WS
>>> handler to the web service or client?  For example, can I
>>> programmatically attach handlers to the web service implementation, or
>>> do XML configuration of handler chains on the *client* side?
>>>
>>> Thanks,
>>> Glen
>>>
>>> [1] http://tinyurl.com/2ps3y2
>>>
>>>
>>>  
>>
>>
>