You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by William Tam <em...@gmail.com> on 2008/11/15 06:06:07 UTC

camel-cxf jaxws handler support

Hi all,

Currently, users can insert jaxws handlers to endpoint by doing
something like this.

  <cxf:cxfEndpoint id="routerEndpoint"
address="http://localhost:8092/PersonService/"
                   serviceClass="org.apache.camel.wsdl_first.Person"
                   endpointName="person:soap"
                   serviceName="person:PersonService"
                   wsdlURL="person.wsdl"
                   xmlns:person="http://camel.apache.org/wsdl-first">

      <cxf:handlers>
          <ref bean="fromEndpointJaxwsHandler"/>
      </cxf:handlers>
  </cxf:cxfEndpoint>

It only works on the CxfConsumer side but not on the CxfProducer side.
  It is because CXF server and client factory bean are not exactly
"symmetrical".  I can think of two approaches to fix it.

1)  Mimic the Jaxws Handler stuff in CXF
(http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java)
and add it to Camel's CxfClientFactoryBean
(https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClientFactoryBean.java).
 It could mean more maintenance work in Camel.

2) In CxfProducer, switching from using CXF's
ClientFactoryBean/JaxWsClientFactoryBean to
ClientProxyFactoryBean/JaxWsProxyFactoryBean.  The latter seems to be
more frequently used inside CXF.  The JaxWsProxyFactoryBean can build
the handler chain and does all the low level work.  The only downside
that I see is, the SEI passed to the factory bean must be an interface
(cannot not be a class).

Any thoughts?

Thanks,
William

Re: camel-cxf jaxws handler support

Posted by William Tam <em...@gmail.com>.
We can keep the existing simple front end API (ClientFactoryBean) and
that is leaving the CxfClientFactoryBean as is.

When the code need to create a client object, our CxfClientFactoryBean
object is passed to the constructor of JaxWsProxyFactoryBean (if
jsr181 is enabled) or ClientProxyFactdoryBean and invoke the create()
method on the prox factory bean instead.

public JaxWsProxyFactoryBean(ClientFactoryBean fact) {
        super(fact);
    }

The idea is to let the proxy JaxWsProxyFactoryBean take care of the
Jaxws handler chain for us.   It is probably more clear when you can
look a my patch.  I will open a JIRA.

-William

On Sat, Nov 15, 2008 at 2:42 AM, Willem Jiang <wi...@gmail.com> wrote:
> Hi William,
>
> I just have one question about it , if we want to use the simple front end
> API to create the endpoint, how do you switch the JaxWsProxyFactoryBean to
> ProxyFactoryBean?
>
> Besides that , I'm OK for your proposal.
>
> Willem
>
> On Sat, Nov 15, 2008 at 2:30 PM, William Tam <em...@gmail.com> wrote:
>
>> BTW, I am in favor of #2 and to document that SEI must be an interface.
>>
>> On Sat, Nov 15, 2008 at 12:06 AM, William Tam <em...@gmail.com>
>> wrote:
>> > Hi all,
>> >
>> > Currently, users can insert jaxws handlers to endpoint by doing
>> > something like this.
>> >
>> >  <cxf:cxfEndpoint id="routerEndpoint"
>> > address="http://localhost:8092/PersonService/"
>> >                   serviceClass="org.apache.camel.wsdl_first.Person"
>> >                   endpointName="person:soap"
>> >                   serviceName="person:PersonService"
>> >                   wsdlURL="person.wsdl"
>> >                   xmlns:person="http://camel.apache.org/wsdl-first">
>> >
>> >      <cxf:handlers>
>> >          <ref bean="fromEndpointJaxwsHandler"/>
>> >      </cxf:handlers>
>> >  </cxf:cxfEndpoint>
>> >
>> > It only works on the CxfConsumer side but not on the CxfProducer side.
>> >  It is because CXF server and client factory bean are not exactly
>> > "symmetrical".  I can think of two approaches to fix it.
>> >
>> > 1)  Mimic the Jaxws Handler stuff in CXF
>> > (
>> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
>> )
>> > and add it to Camel's CxfClientFactoryBean
>> > (
>> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClientFactoryBean.java
>> ).
>> >  It could mean more maintenance work in Camel.
>> >
>> > 2) In CxfProducer, switching from using CXF's
>> > ClientFactoryBean/JaxWsClientFactoryBean to
>> > ClientProxyFactoryBean/JaxWsProxyFactoryBean.  The latter seems to be
>> > more frequently used inside CXF.  The JaxWsProxyFactoryBean can build
>> > the handler chain and does all the low level work.  The only downside
>> > that I see is, the SEI passed to the factory bean must be an interface
>> > (cannot not be a class).
>> >
>> > Any thoughts?
>> >
>> > Thanks,
>> > William
>> >
>>
>

Re: camel-cxf jaxws handler support

Posted by Willem Jiang <wi...@gmail.com>.
Hi William,

I just have one question about it , if we want to use the simple front end
API to create the endpoint, how do you switch the JaxWsProxyFactoryBean to
ProxyFactoryBean?

Besides that , I'm OK for your proposal.

Willem

On Sat, Nov 15, 2008 at 2:30 PM, William Tam <em...@gmail.com> wrote:

> BTW, I am in favor of #2 and to document that SEI must be an interface.
>
> On Sat, Nov 15, 2008 at 12:06 AM, William Tam <em...@gmail.com>
> wrote:
> > Hi all,
> >
> > Currently, users can insert jaxws handlers to endpoint by doing
> > something like this.
> >
> >  <cxf:cxfEndpoint id="routerEndpoint"
> > address="http://localhost:8092/PersonService/"
> >                   serviceClass="org.apache.camel.wsdl_first.Person"
> >                   endpointName="person:soap"
> >                   serviceName="person:PersonService"
> >                   wsdlURL="person.wsdl"
> >                   xmlns:person="http://camel.apache.org/wsdl-first">
> >
> >      <cxf:handlers>
> >          <ref bean="fromEndpointJaxwsHandler"/>
> >      </cxf:handlers>
> >  </cxf:cxfEndpoint>
> >
> > It only works on the CxfConsumer side but not on the CxfProducer side.
> >  It is because CXF server and client factory bean are not exactly
> > "symmetrical".  I can think of two approaches to fix it.
> >
> > 1)  Mimic the Jaxws Handler stuff in CXF
> > (
> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
> )
> > and add it to Camel's CxfClientFactoryBean
> > (
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClientFactoryBean.java
> ).
> >  It could mean more maintenance work in Camel.
> >
> > 2) In CxfProducer, switching from using CXF's
> > ClientFactoryBean/JaxWsClientFactoryBean to
> > ClientProxyFactoryBean/JaxWsProxyFactoryBean.  The latter seems to be
> > more frequently used inside CXF.  The JaxWsProxyFactoryBean can build
> > the handler chain and does all the low level work.  The only downside
> > that I see is, the SEI passed to the factory bean must be an interface
> > (cannot not be a class).
> >
> > Any thoughts?
> >
> > Thanks,
> > William
> >
>

Re: camel-cxf jaxws handler support

Posted by William Tam <em...@gmail.com>.
BTW, I am in favor of #2 and to document that SEI must be an interface.

On Sat, Nov 15, 2008 at 12:06 AM, William Tam <em...@gmail.com> wrote:
> Hi all,
>
> Currently, users can insert jaxws handlers to endpoint by doing
> something like this.
>
>  <cxf:cxfEndpoint id="routerEndpoint"
> address="http://localhost:8092/PersonService/"
>                   serviceClass="org.apache.camel.wsdl_first.Person"
>                   endpointName="person:soap"
>                   serviceName="person:PersonService"
>                   wsdlURL="person.wsdl"
>                   xmlns:person="http://camel.apache.org/wsdl-first">
>
>      <cxf:handlers>
>          <ref bean="fromEndpointJaxwsHandler"/>
>      </cxf:handlers>
>  </cxf:cxfEndpoint>
>
> It only works on the CxfConsumer side but not on the CxfProducer side.
>  It is because CXF server and client factory bean are not exactly
> "symmetrical".  I can think of two approaches to fix it.
>
> 1)  Mimic the Jaxws Handler stuff in CXF
> (http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java)
> and add it to Camel's CxfClientFactoryBean
> (https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClientFactoryBean.java).
>  It could mean more maintenance work in Camel.
>
> 2) In CxfProducer, switching from using CXF's
> ClientFactoryBean/JaxWsClientFactoryBean to
> ClientProxyFactoryBean/JaxWsProxyFactoryBean.  The latter seems to be
> more frequently used inside CXF.  The JaxWsProxyFactoryBean can build
> the handler chain and does all the low level work.  The only downside
> that I see is, the SEI passed to the factory bean must be an interface
> (cannot not be a class).
>
> Any thoughts?
>
> Thanks,
> William
>