camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Re: CXF - camel CXF
Date Mon, 30 Nov 2009 15:18:30 GMT
If you recommend to call directly the service from the POJO where we have
added REST annotation, what is the purpose of this route presented as an
example in camel-cxf test if the cxf:rsServer:bean:server endpoint can
directly answer to a GET/PUT,POST, ... call ?

<route>
<cxf:rsServer:bean:server/>
<cxf:rsClient:bean:client/>
</route>

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Mon, Nov 30, 2009 at 3:53 PM, Willem Jiang <willem.jiang@gmail.com>wrote:

> Hi Charles,
>
> You don't need to use the camel cxfrs route all the time, if you have to
>  retrieve the DB for the REST request.
>
> You just need to define a POJO with annotation, and use OR mapping
> framework to implement retrieve or update the data for your service. You
> don't need to let camel be involved ;)
>
> Willem
>
>
>
> Charles Moulliard wrote:
>
>> Hi,
>>
>> If camel is used in combination with CXF to handle REST services, How must
>> be designed the POJOs managing the REST services ?
>>
>> eg. camel spring config
>>
>>    <cxf:rsServer id="rsServer" address="/camel-rest-example/"
>>
>>
>> serviceClass="org.apache.camel.example.reportincident.restful.ReportIncidentService"
>> />
>>
>>    <cxf:rsClient id="rsClient" address="http://localhost:8181/cxf/http/"
>> />
>>
>>    <camel:camelContext trace="true"
>>        xmlns="http://camel.apache.org/schema/osgi">
>>
>>        <camel:route>
>>            <camel:from uri="cxfrs:bean:rsServer" /> // REST HTTP Service
>> receiving the call from REST client and providing reply
>>            <camel:bean ref="service" method="getCustomer" />
>>            <camel:to uri="activemq:queue:IN"/>
>>        </camel:route>
>>
>>       <camel:route>
>>            <camel:from uri="activemq:queue:IN" />
>>            <camel:to uri="cxfrs:bean:rsClient" /> // HTTP (internal
>> client)
>> who will generate HTTP reply using CXF - jaxrs:server component to
>> cxfrs:bean:rsServer endpoint
>>        </camel:route>
>>
>> Do we have to create two POJOs (one for the request and the other for the
>> reply ?
>> If this is the case, how the method must be defined to provide the REST
>> info
>> (request, parameters, ...) to the camel endpoint (= camel bean) who will
>> be
>> in charge to retrieve by example info from DB ? idem but for the method
>> who
>> will be send back the reply to the client calling the REST service ?
>>
>> ex : Request
>>
>>    @GET
>>    @Path("/customers/{id}/")
>>    public String getCustomer(@PathParam("id") String id) {
>>        return id;
>>    }
>>
>> ex: reply
>>
>>    @GET
>>    @Path("/customers/{id}/")
>>    public Customer getCustomer(Customer customer) {
>>        return customer;
>>    }
>>
>>
>> Regards,
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>> twitter : http://twitter.com/cmoulliard
>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>
>> Apache Camel Group :
>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message