Please check out my comments in the mail.
On Thu, Jul 26, 2012 at 3:00 AM, bitter geek <[email protected]> wrote:
> Hi Sergey,
>
> I'm quite new to Camel, still trying to get my head around a few concepts.
>
> How do you create a camel-cxfrs producer? Or for that matter, how do you
> specify what type of producer to create?
You can setup the camel-cxfrs endpoint from Spring configuration which
you already know about it.
Camel will create the producer for you as the definition shows.
>
> Does this have anything to do with the header
> CxfConstants.CAMEL_CXF_RS_USING_HTTP_API as shown below?
Camel will create the client dynamically per request, and the header
setting will help camel to decide which kind of client it should use.
As Sergey said, the HTTP_API client is used by default, and Camel can
create a proxy type client if you set the header value to be false.
>
> Thanks!
>
> Exchange exchange = template.send("direct://proxy", new Processor() {
> public void process(Exchange exchange) throws Exception {
> exchange.setPattern(ExchangePattern.InOut);
> Message inMessage = exchange.getIn();
> setupDestinationURL(inMessage);
> // set the operation name
> inMessage.setHeader(CxfConstants.OPERATION_NAME, "getCustomer");
> // using the proxy client API
> inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
> Boolean.FALSE);
> // set a customer header
> inMessage.setHeader("key", "value");
> // set the parameters , if you just have one parameter
> // camel will put this object into an Object[] itself
> inMessage.setBody("123");
> }
> });
>
> On 7/25/12, Sergey Beryozkin <[email protected]> wrote:
>> On 25/07/12 09:30, bitter geek wrote:
>>> Hi Sergey,
>>>
>>> Can you elaborate on how to use CXF RS endpoint without using the
>>> producer?
>>>
>>
>> The CXFRS producer is a component built on top of the CXF RS client
>> code, however you do not have to use it in order to talk to a RS service
>> given the way that service is implemented is not important (could be
>> CXFRS on the other end or could be a PHP-based web app),
>> Here are some links:
>>
>> http://camel.apache.org/restlet.html
>> http://camel.apache.org/jetty.html
>> http://camel.apache.org/http.html
>>
>> Try one of those (I haven't tried). In meantime we'll work on getting
>> the CXFRS client component thread-safe
>>
>> Sergey
>>
>>> You help is much appreciated.
>>>
>>> Thanks,
>>>
>>> Bing
>>>
>>> On 7/24/12, Sergey Beryozkin<[email protected]> wrote:
>>>> I lost your private email,
>>>>
>>>> the CXF RS endpoint is safe, only the producer is not right now
>>>>
>>>> Cheers, Sergey
>>>>
>>>> On 24/07/12 15:00, Sergey Beryozkin wrote:
>>>>> Hi
>>>>> On 24/07/12 14:52, bitter geek wrote:
>>>>>> Hi All,
>>>>>>
>>>>>> I'm a bit confused with the sample code for creating rest endpoint.
>>>>>>
>>>>>> I do not have access to the rest service class but only want to create
>>>>>> a rest endpoint to use with camel.
>>>>>>
>>>>>> Do I only need to create rsClient tag? If so, what class do I put
>>>>>> there for serviceClass? Why does it need a serviceClass if this
>>>>>> endpoint is just used to make an http request?
>>>>>>
>>>>> I believe this option is there to make a proxy based invocation, for
>>>>> the
>>>>> produce/consumes types be derived from specific operations available on
>>>>> the service class.
>>>>>
>>>>> However, the cxf rs producer is not thread safe right now.
>>>>> So I'd recommend you try one of the other Camel HTTP components which
>>>>> can make outbound calls till we get it fixed (http, jetty, etc - I'm
>>>>> assuming they are thread-safe on the client side), or please experiment
>>>>> with embedding direct thread-safe cxf jaxrs/web client references into
>>>>> the root
>>>>>
>>>>> Sergey
>>>>>
>>>>>> In addition, how do I get hold of this endpoint in Java?
>>>>>>
>>>>>> Thanks a lot for your help!
>>>>>>
>>>>>> Bing
>>>>>>
>>>>>> /////////////////////////////////////////////////////
>>>>>> <!-- Defined the server endpoint to create the cxf-rs consumer -->
>>>>>> <cxf:rsServer id="rsServer"
>>>>>> address="http://localhost:${CXFTestSupport.port1}/CxfRsRouterTest/route"
>>>>>> serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
>>>>>>
>>>>>> loggingFeatureEnabled="true" loggingSizeLimit="20"/>
>>>>>>
>>>>>> <!-- Defined the client endpoint to create the cxf-rs consumer -->
>>>>>> <cxf:rsClient id="rsClient"
>>>>>> address="http://localhost:${CXFTestSupport.port2}/CxfRsRouterTest/rest"
>>>>>> serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
>>>>>>
>>>>>> loggingFeatureEnabled="true" />
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Sergey Beryozkin
>>>>
>>>> Talend Community Coders
>>>> http://coders.talend.com/
>>>>
>>>> Blog: http://sberyozkin.blogspot.com
>>>>
>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>