camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jejmaster <jejmas...@gmail.com>
Subject Re: Null parameters when routing CXFRS endpoints
Date Fri, 09 Apr 2010 09:50:07 GMT

Hi Willem,

Its working enough in 2.3-SNAPSHOT. but we decided to use 2.2 as of the
moment until 2.3 gets released. 

Do you recommend on the httpclient rather than the proxyClient? 

Jejo



willem.jiang wrote:
> 
> Hi Jejo
> 
> Please feel free to log a JIRA for it, doesn't the HttpClient work good 
> for you ?
> 
> Willem
> 
> jejmaster wrote:
>> I found out that JAXRS Client only sends 1 parameter. So i will just have
>> to
>> configure my service class to only accept 1 parameter instead of two. Ill
>> just wrap it in a transfer object. 
>> 
>> Anyway, maybe as a enhancement to camel-cxf jaxrs, hopefully we can also
>> use
>> and support different rest clients such as Httpclient and URLStream so
>> form
>> parameters can also be allowed. 
>> 
>> Regards,
>> Jejo 
>> 
>> 
>> 
>> jejmaster wrote:
>>> Hi Willem,
>>>
>>> I just used the TestProcessor to see the value of the
>>> inMessage.getBody()
>>> because even if there's no processor, the parameters really gets null
>>> when
>>> routed.
>>>
>>> I am digging the code right now at CxfRSProducer. And it seems that the
>>> problem is in the Reflection part in the method invokeProxyClient. 
>>>
>>> Object response = method.invoke(target, parameters);
>>>
>>> i have logged the parameters before this part and the values were still
>>> in
>>> there. 
>>>
>>> I have also tried updating how JAXRSClientFactoryBean (cfb) is used as a
>>> jaxrs client. 
>>>
>>> Example:
>>>
>>> BindingFactoryManager manager =
>>> cfb.getBus().getExtension(BindingFactoryManager.class);
>>> JAXRSBindingFactory factory = new JAXRSBindingFactory();
>>> factory.setBus(cfb.getBus());
>>> manager.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID,
>>> factory);
>>> Object targetClass = cfb.create(sfb.getResourceClasses().get(0));
>>>
>>> Object response = method.invoke(targetClass , parameters);
>>>
>>>
>>> Still, the parameters, gets null after this method.invoke(..)
>>> reflection. 
>>>
>>>
>>> Im still digging on it and checking if i could replicate the reflection
>>> part. Can you also analyze/replicate it?
>>>
>>> Thanks.
>>>
>>>
>>>
>>> willem.jiang wrote:
>>>> Hi,
>>>>
>>>> Can I see the code that you do in the testProcessor?
>>>> If you don't set the exchange.outMessage(), you should get the right 
>>>> parameter from the inMessage body.
>>>>
>>>> Willem
>>>>
>>>>
>>>> jejmaster wrote:
>>>>> Hello,
>>>>>
>>>>> I am using the Camel 2.3-SNAPSHOT and implementing the CXFRS routing
>>>>> through
>>>>> ProxyClient. I have setup my JAXRS Service Class method to accept 2
>>>>> parameters, a String and an Object. The service is working fine when
i
>>>>> am
>>>>> invoking it directly but when i am using the cxfrs camel routing, 
>>>>> these
>>>>> 2
>>>>> parameters are having null values. Anyway here's my setup:
>>>>>
>>>>> My Service/Resource Class:
>>>>>
>>>>> @Path("/myservice")
>>>>> Class MyService{
>>>>>
>>>>>    @POST
>>>>>    @Path("/myMethod")
>>>>>    public ModelCollectionTO getPatients(@FormParam("loc") String
>>>>> location,
>>>>> @FormParam("") ModelTO modelTO){
>>>>>              log.debug(location);
>>>>>              log.debug(modelTO);
>>>>>              ....
>>>>>     }
>>>>> }
>>>>>
>>>>> Router Definition:
>>>>>
>>>>> <route>
>>>>> 	<from uri="cxfrs:bean:serviceRouter" />
>>>>>              <process ref="testProcessor" />
>>>>> 	<to uri="cxfrs:bean:serviceEndpoint?httpClientAPI=false" />
>>>>> </route>
>>>>>
>>>>> I tried to use a test processor to capture the exchange and the
>>>>> inMessage.
>>>>> The 2 parameters are correct. with values:
>>>>>
>>>>> location: "String";
>>>>> ModelTO: firstName="FirstName", lastName="LastName"
>>>>>
>>>>> But after it routes through the endpoint, the 2 parameters are getting
>>>>> null
>>>>> values:
>>>>>
>>>>> location: null;
>>>>> ModelTO: firstname=null, lastName=null.
>>>>>
>>>>>
>>>>> I have checked the camel-cxf code and enabled the Trace logging. I
>>>>> might
>>>>> need additional logs in the invokeProxyClient method of the
>>>>> CxfRsProducer to
>>>>> see where the inMessage.getBody() values gets converted or loss
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Null-parameters-when-routing-CXFRS-endpoints-tp28186748p28190020.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message