You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Glen Mazza <gl...@verizon.net> on 2007/12/26 06:25:24 UTC

JAX-WS handler attachment options within Apache CXF

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



Re: JAX-WS handler attachment options within Apache CXF

Posted by Glen Mazza <gl...@gmail.com>.
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
>>>>
>>>>
>>>>   
>>>
>>>
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JAX-WS-handler-attachment-options-within-Apache-CXF-tp14499697p14552937.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JAX-WS handler attachment options within Apache CXF

Posted by Glen Mazza <gl...@gmail.com>.

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

-- 
View this message in context: http://www.nabble.com/JAX-WS-handler-attachment-options-within-Apache-CXF-tp14499697p14552815.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JAX-WS handler attachment options within Apache CXF

Posted by Jim Ma <em...@iona.com>.
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
>>>>
>>>>
>>>>   
>>>
>>>
>>
>

Re: JAX-WS handler attachment options within Apache CXF

Posted by Willem Jiang <wi...@gmail.com>.
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
>>>
>>>
>>>   
>>
>>
>


Re: JAX-WS handler attachment options within Apache CXF

Posted by James Mao <ja...@iona.com>.
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
>>
>>
>>   
>
>

Re: JAX-WS handler attachment options within Apache CXF

Posted by James Mao <ja...@iona.com>.
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
>
>
>