Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 36365 invoked from network); 1 Dec 2009 09:41:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Dec 2009 09:41:02 -0000 Received: (qmail 30329 invoked by uid 500); 1 Dec 2009 09:41:02 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 30286 invoked by uid 500); 1 Dec 2009 09:41:01 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 30276 invoked by uid 99); 1 Dec 2009 09:41:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Dec 2009 09:41:01 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of willem.jiang@gmail.com designates 209.85.210.203 as permitted sender) Received: from [209.85.210.203] (HELO mail-yx0-f203.google.com) (209.85.210.203) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Dec 2009 09:40:49 +0000 Received: by yxe41 with SMTP id 41so7520159yxe.30 for ; Tue, 01 Dec 2009 01:40:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=0n3COEcMuqdgn+HRhHmNda8IJvX4wREvoADTdqt8kNo=; b=CMFOP5nUn8ioaGbtlirjPWKL35MdLbf1x1viaHS3/QbdwPDQojp8R2yEB4g8J6+CCu IKRT1cYZP708RmB5rOdW/EvJr1e+PDu6PE4y0WtZo+5MLycihpQpV/FvfbQpyVm4jxgO iiKx++FpiCs7RxI0PFwfBEuL+hiZ7OvOVywiQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=TARsAryZ2r+nnFKQ9BBF44Ejv4/V3h0R//wmSSJiOK+Rcx1PrBdSnIicfGTX9wiAyd vdHWe8JoSZ/YuNDFaK2/ePLENl1/DDQAvlYuk3sZtakgRp+IZEWuuJXkndNXNfViy+3c cf0WxT+VPvwk5jFuvB5BGGu6D7hb3BAGN+K+0= Received: by 10.150.70.13 with SMTP id s13mr9274710yba.319.1259660428345; Tue, 01 Dec 2009 01:40:28 -0800 (PST) Received: from ?192.168.0.158? ([123.116.32.143]) by mx.google.com with ESMTPS id 6sm1971962ywc.24.2009.12.01.01.40.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 01 Dec 2009 01:40:27 -0800 (PST) Message-ID: <4B14E485.2050106@gmail.com> Date: Tue, 01 Dec 2009 17:40:21 +0800 From: Willem Jiang User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: users@camel.apache.org Subject: Re: CXF - camel CXF References: <4B13DC55.3020200@gmail.com> <4B13E442.3030204@gmail.com> <4B14825F.6060200@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org It should work, but you need to some additional work. As cxfrs producer uses the HttpClient API by default, it is different with the camel-cxf's client API, so you need to find some way to deal with the REST response object issue which you shows in CAMEL-2239. In camel-example-cxf , we have an example[1] to show how to provides a service which support soap request and REST at same time. [1]https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/jaxrs/CamelRouterBuilder.java Willem Charles Moulliard wrote: > Hi Willem, > > To come back to REST implementation between Camel - CXF, can you tell me why > we cannot do the same thing (RESTfull services) that we can do for CXF web > service ? > > Here is the camel route that I use in my camel osgi tutorial (part2) > > > > > webservice > > type="org.apache.camel.example.reportincident.InputReportIncident" /> > > > > > > > > > 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 Tue, Dec 1, 2009 at 3:41 AM, Willem Jiang wrote: > >> Hi Charles, >> >> It really dependents on your use case. >> >> Here is an user case, if have bunch of back end (jaxrs:server) services, >> and you want to do a content based routing, you can user setup a camel >> cxfrsServer and let the client access this server. Then camel route will >> take care rest of things :) >> >> >> Willem >> >> Charles Moulliard wrote: >> >>> If it makes no sense to use rsServer and rsClient both together in a camel >>> route, what is the advantage to use a camel cxfrsServer endpoint over the >>> jaxrs:server endpoint ? >>> >>> 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 4:26 PM, Willem Jiang >>> wrote: >>> Oh, this test case just show how camel-cxfrs consumer and camel-cxfrs >>>> producer work together. >>>> >>>> It is not easy to write a bunch of tests to verify a camel-cxfrs consumer >>>> can response different request in a short time, so why not we create a >>>> camel-cxfrs route in Camel to test the consumer and producer at the same >>>> time. >>>> >>>> Willem >>>> >>>> >>>> Charles Moulliard wrote: >>>> >>>> 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 ? >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> 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 >>>> >>>>>> 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 >>>>>>> >>>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> serviceClass="org.apache.camel.example.reportincident.restful.ReportIncidentService" >>>>>>> /> >>>>>>> >>>>>>> >>>>>> /> >>>>>>> >>>>>>> >>>>>> xmlns="http://camel.apache.org/schema/osgi"> >>>>>>> >>>>>>> >>>>>>> // REST HTTP Service >>>>>>> receiving the call from REST client and providing reply >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> // HTTP (internal >>>>>>> client) >>>>>>> who will generate HTTP reply using CXF - jaxrs:server component to >>>>>>> cxfrs:bean:rsServer endpoint >>>>>>> >>>>>>> >>>>>>> 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 >>>>>>> >>>>>>> >>>>>>> >>>>>>> >