You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by huntc <hu...@mac.com> on 2008/10/17 11:48:16 UTC

Camel inside CXF or CXF inside Camel

Hi there,

I'm looking for a little guidance on best-practice use of CXF and Camel.

I have a CXF based web service and I would like to publish the payload it
receives to a topic. I then want various subscribers to the topic to receive
the payload and subsequently process it.

My CXF service is presently housed in a Tomcat container, but I'm thinking
that I should use the Spring container and house a Camel context. I would
then declare my CXF service to my Camel context so that I could route from
it.

Does this sound like the right approach?

If so then does my CXF service implementation become obsolete? i.e. is it
just my SEI that gets used if all that I want to do is publish the payload
it receives to the topic?

Kind regards,
Christopher
-- 
View this message in context: http://www.nabble.com/Camel-inside-CXF-or-CXF-inside-Camel-tp20030207s22882p20030207.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel inside CXF or CXF inside Camel

Posted by huntc <hu...@mac.com>.
Thank you so much for your guidance.

I have a question though:


cmoulliard wrote:
> 
>    <cxf:cxfEndpoint id="service"
>             address="http://localhost:9000/service" 
>     	    serviceClass="com.mycompany.service.impl.ServiceImpl"
>             dataformat="PAYLOAD"
>     />
> 
> 

ServiceImpl implies that you're using the implementation class of the SEI,
not just the SEI i.e. the class and not its interface. I'm curious as to
what the implementation actually does. Are you able to show me what is
inside ServiceImpl?

In my case if the CXF unmarshalling is fine, and the service can
successfully pass on the payload as an Exchange object to Camel, then I'm
happy for a successful response to be returned to the web service client. Do
I need a service implementation to achieve that or will Camel do something
magical there?

Thanks for helping me understand.

Kind regards,
Christopher
-- 
View this message in context: http://www.nabble.com/Camel-inside-CXF-or-CXF-inside-Camel-tp20030207s22882p20041693.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel inside CXF or CXF inside Camel

Posted by cmoulliard <cm...@gmail.com>.
Hi Christopher,

You are right in your approach. By importing your CXF web service into
Camel, you will benefit of the camel power to extract the payload of the
message and send it to a queue/topic where different subscribers are
listening

here is an example that you can follow :

   <cxf:cxfEndpoint id="service"
            address="http://localhost:9000/service" 
    	    serviceClass="com.mycompany.service.impl.ServiceImpl"
            dataformat="PAYLOAD"
    />
    		
   <camelContext id="camel" trace="true"
xmlns="http://activemq.apache.org/camel/schema/spring">
    <route>
      <from uri="cxf:bean:service" />
      <to uri="bean:tracker" />
      <to uri="jms:queueTopic" /
    </route>
   </camelContext> 
   
   <bean id="tracker" class="com.xpectis.tracker.bean.ExtractPayaload"/>

Remark : It is perhaps possible to extract directly the Payload without
sending the message to a Bean using the option dataformat=PAYLOAD but
personally I haven't test it

KR,

Christopher
 

huntc wrote:
> 
> Hi there,
> 
> I'm looking for a little guidance on best-practice use of CXF and Camel.
> 
> I have a CXF based web service and I would like to publish the payload it
> receives to a topic. I then want various subscribers to the topic to
> receive the payload and subsequently process it.
> 
> My CXF service is presently housed in a Tomcat container, but I'm thinking
> that I should use the Spring container and house a Camel context. I would
> then declare my CXF service to my Camel context so that I could route from
> it.
> 
> Does this sound like the right approach?
> 
> If so then does my CXF service implementation become obsolete? i.e. is it
> just my SEI that gets used if all that I want to do is publish the payload
> it receives to the topic?
> 
> Kind regards,
> Christopher
> 


-----
Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : cmoulliard@xpectis.com
web site :  www.xpectis.com www.xpectis.com 
My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: http://www.nabble.com/Camel-inside-CXF-or-CXF-inside-Camel-tp20030207s22882p20030416.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Camel inside CXF or CXF inside Camel

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

I don't think so. The code in JettyHttpComponent is jetty based and creates its own listener etc.

What we should support is to let users do the wiring in web.xml in the existing container, e.g. having a CamelServlet 


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Christian Schneider [mailto:chris@die-schneider.net] 
Sent: 18. oktober 2008 10:48
To: camel-user@activemq.apache.org
Subject: Re: Camel inside CXF or CXF inside Camel

Is there currently no way to do this in camel ?

Greetings

Christian

Claus Ibsen schrieb:
> +1
>
> A great idea Willem
>
> Med venlig hilsen
>  
>
> In CXF , we leverage the servlet transport to publish the service through
> Tomcat. Maybe we can port some part of CXF Servlet to Camel, in this way we
> can deploy Camel Servlet transport into Tomcat and send the message into a
> camel context :)
>
> Thoughts?
>
> Willem
>
> On Sat, Oct 18, 2008 at 7:52 AM, Christian Schneider <
> chris@die-schneider.net> wrote:
>
>   


-- 

Christian Schneider
---
http://www.liquid-reality.de


Re: Camel inside CXF or CXF inside Camel

Posted by Christian Schneider <ch...@die-schneider.net>.
Is there currently no way to do this in camel ?

Greetings

Christian

Claus Ibsen schrieb:
> +1
>
> A great idea Willem
>
> Med venlig hilsen
>  
>
> In CXF , we leverage the servlet transport to publish the service through
> Tomcat. Maybe we can port some part of CXF Servlet to Camel, in this way we
> can deploy Camel Servlet transport into Tomcat and send the message into a
> camel context :)
>
> Thoughts?
>
> Willem
>
> On Sat, Oct 18, 2008 at 7:52 AM, Christian Schneider <
> chris@die-schneider.net> wrote:
>
>   


-- 

Christian Schneider
---
http://www.liquid-reality.de


RE: Camel inside CXF or CXF inside Camel

Posted by Claus Ibsen <ci...@silverbullet.dk>.
+1

A great idea Willem

Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Willem Jiang [mailto:willem.jiang@gmail.com] 
Sent: 18. oktober 2008 03:26
To: camel-user@activemq.apache.org
Subject: Re: Camel inside CXF or CXF inside Camel

In CXF , we leverage the servlet transport to publish the service through
Tomcat. Maybe we can port some part of CXF Servlet to Camel, in this way we
can deploy Camel Servlet transport into Tomcat and send the message into a
camel context :)

Thoughts?

Willem

On Sat, Oct 18, 2008 at 7:52 AM, Christian Schneider <
chris@die-schneider.net> wrote:

> Hi Christopher,
>
> if I understand you right you want to have a http endpoint that simply
> receives a soap message and sends it to a topic. Is that right?
> In that case you do not need cxf at all. cxf is only needed if you want to
> deserialize the soap message and call a java implementation.
>
> Simply do something like that in camel:
>
> from("jetty:http://localhost:8080/myapp/myservice
> ").to("jms://topic:topicname")
>
> Look at the jetty and jms components for more details.
>
> I think the jetty component is normally used if you are not running in
> tomcat. I do not know how to receive a request using tomcat but I am
> sure someone can help here.
>
> Greetings
>
> Christian
>
>
> huntc schrieb:
>
>> Hi Christian,
>>
>> Thank you for the guidance here. I have indeed read your fine article
>> although I am curious as to what the CXF web service implementation should
>> do if all that is required is to pass on its parameters as a Camel
>> Exchange,
>> and return success if it can do so successfully. Any advice there?
>>
>> Kind regards,
>> Christopher
>>
>>
>>
>>
>
>
> --
>
> Christian Schneider
> ---
> http://www.liquid-reality.de
>
>

Re: Camel inside CXF or CXF inside Camel

Posted by Willem Jiang <wi...@gmail.com>.
In CXF , we leverage the servlet transport to publish the service through
Tomcat. Maybe we can port some part of CXF Servlet to Camel, in this way we
can deploy Camel Servlet transport into Tomcat and send the message into a
camel context :)

Thoughts?

Willem

On Sat, Oct 18, 2008 at 7:52 AM, Christian Schneider <
chris@die-schneider.net> wrote:

> Hi Christopher,
>
> if I understand you right you want to have a http endpoint that simply
> receives a soap message and sends it to a topic. Is that right?
> In that case you do not need cxf at all. cxf is only needed if you want to
> deserialize the soap message and call a java implementation.
>
> Simply do something like that in camel:
>
> from("jetty:http://localhost:8080/myapp/myservice
> ").to("jms://topic:topicname")
>
> Look at the jetty and jms components for more details.
>
> I think the jetty component is normally used if you are not running in
> tomcat. I do not know how to receive a request using tomcat but I am
> sure someone can help here.
>
> Greetings
>
> Christian
>
>
> huntc schrieb:
>
>> Hi Christian,
>>
>> Thank you for the guidance here. I have indeed read your fine article
>> although I am curious as to what the CXF web service implementation should
>> do if all that is required is to pass on its parameters as a Camel
>> Exchange,
>> and return success if it can do so successfully. Any advice there?
>>
>> Kind regards,
>> Christopher
>>
>>
>>
>>
>
>
> --
>
> Christian Schneider
> ---
> http://www.liquid-reality.de
>
>

Re: Camel inside CXF or CXF inside Camel

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Christopher,

in this case it is probably best to create a cxf wbservice and a cxf 
proxy with the same WSDL.
You create the webservice with http binding and the proxy with jms 
binding. Most you need can be found in my tutorial.

Then in the implementation of the webservice you simply call the proxy 
with the data you receive.

Greetings

Christian


huntc schrieb:
> Hi Christian,
>
> Sorry for not explaining myself better - I want more than an http endpoint -
> I want the SOAP endpoint and the resultant JAXB object. If the validation
> fails then I want the SOAP endpoint to return a fault. If I can't post to
> the topic then I also want to generate a fault.
>
> Thanks again.
>
> Kind regards,
> Christopher
>
>   


-- 

Christian Schneider
---
http://www.liquid-reality.de


Re: Camel inside CXF or CXF inside Camel

Posted by huntc <hu...@mac.com>.
Hi Christian,

Sorry for not explaining myself better - I want more than an http endpoint -
I want the SOAP endpoint and the resultant JAXB object. If the validation
fails then I want the SOAP endpoint to return a fault. If I can't post to
the topic then I also want to generate a fault.

Thanks again.

Kind regards,
Christopher

-- 
View this message in context: http://www.nabble.com/Camel-inside-CXF-or-CXF-inside-Camel-tp20030207s22882p20045275.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel inside CXF or CXF inside Camel

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Christopher,

if I understand you right you want to have a http endpoint that simply 
receives a soap message and sends it to a topic. Is that right?
In that case you do not need cxf at all. cxf is only needed if you want 
to deserialize the soap message and call a java implementation.

Simply do something like that in camel:

from("jetty:http://localhost:8080/myapp/myservice").to("jms://topic:topicname")

Look at the jetty and jms components for more details.

I think the jetty component is normally used if you are not running in tomcat. I do not know how to receive a request using tomcat but I am
sure someone can help here.

Greetings

Christian


huntc schrieb:
> Hi Christian,
>
> Thank you for the guidance here. I have indeed read your fine article
> although I am curious as to what the CXF web service implementation should
> do if all that is required is to pass on its parameters as a Camel Exchange,
> and return success if it can do so successfully. Any advice there?
>
> Kind regards,
> Christopher
>
>
>   


-- 

Christian Schneider
---
http://www.liquid-reality.de


Re: Camel inside CXF or CXF inside Camel

Posted by huntc <hu...@mac.com>.
Hi Christian,

Thank you for the guidance here. I have indeed read your fine article
although I am curious as to what the CXF web service implementation should
do if all that is required is to pass on its parameters as a Camel Exchange,
and return success if it can do so successfully. Any advice there?

Kind regards,
Christopher


-- 
View this message in context: http://www.nabble.com/Camel-inside-CXF-or-CXF-inside-Camel-tp20030207s22882p20041730.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel inside CXF or CXF inside Camel

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Christopher,

you should take a look at the following example:
http://activemq.apache.org/camel/better-jms-transport-for-cxf-webservice-using-apache-camel.html

This tutorial describes how to use the camel transport for cxf. It is a 
better integration with cxf than using the cxf endpoint.

If the only thing you want to have is a better jms configuration for cxf 
you can also wait for cxf 2.1.3 which will be out in one or two weeks.
Then cxf will include a new much better configuration for jms endpoints.

Greetings

Christian

huntc schrieb:
> Hi there,
>
> I'm looking for a little guidance on best-practice use of CXF and Camel.
>
> I have a CXF based web service and I would like to publish the payload it
> receives to a topic. I then want various subscribers to the topic to receive
> the payload and subsequently process it.
>
> My CXF service is presently housed in a Tomcat container, but I'm thinking
> that I should use the Spring container and house a Camel context. I would
> then declare my CXF service to my Camel context so that I could route from
> it.
>
> Does this sound like the right approach?
>
> If so then does my CXF service implementation become obsolete? i.e. is it
> just my SEI that gets used if all that I want to do is publish the payload
> it receives to the topic?
>
> Kind regards,
> Christopher
>   


-- 

Christian Schneider
---
http://www.liquid-reality.de