You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jejmaster <je...@gmail.com> on 2010/04/09 04:05:00 UTC
Null parameters when routing CXFRS endpoints
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-tp28186748p28186748.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Null parameters when routing CXFRS endpoints
Posted by jejmaster <je...@gmail.com>.
I think you can't have more than 1 resource class to create a right proxy as
i have investigated the code and CxfRsEndpoint only sets the first
resourceClasss upon setting up of JAXRSClientFactoryBean
Here:
protected void setupJAXRSClientFactoryBean(JAXRSClientFactoryBean cfb) {
// address
cfb.setAddress(getEndpointUri());
if (getResourceClasses() != null) {
cfb.setResourceClass(getResourceClasses().get(0));
}
}
This will affect on the reflection part in invokeProxyClient:
Method method = findRightMethod(sfb.getResourceClasses(), methodName,
getParameterTypes(parameters));
It will only get 1 resource class to get the right method.
Jejo
willem.jiang wrote:
>
> I don't think current Spring DSL support to set the Object[] into
> header. I'm afraid you need to use processor or Java DSL to do this job.
>
> Willem
>
> jejmaster wrote:
>> Hi Willem,
>>
>> Thats another good feature. But how do you set the Object[] varValues on
>> CxfConstants.CAMEL_CXF_RS_VAR_VALUES message header via spring xml?
>>
>>
>>
>> <from uri="cxfrs://bean://rsServer"/>
>> <!-- We can remove this configure as the CXFRS producer is using
>> the
>> HttpAPI by default -->
>> <setHeader headerName="CamelCxfRsVarValues">
>> ?
>> </setHeader>
>> <to uri="cxfrs://bean://rsClient"/>
>>
>> Or do I still need to create a processor bean class to manually set this?
>>
>> Regards,
>> Jejo
>>
>>
>>
>> willem.jiang wrote:
>>> Oh. my mistake.
>>> If you take a look at the CxfRsProducer.invokeProxyClient(Exchange
>>> exchange), you will find you need to set
>>> CxfConstants.CAMEL_CXF_RS_VAR_VALUES message header to set the varValues
>>> if there are more than one resource class to create a right proxy.
>>>
>>> Willem
>>>
>>> jejmaster wrote:
>>>> I see. That's great. So you mean the serviceClass parameter is optional
>>>> when
>>>> configuring cxf? How do you expose the service without specifying the
>>>> serviceClass ? Isn't it required configuring at least the cxf:rsServer?
>>>>
>>>> <cxf:rsServer id="restRouter" address="/restRouter/"
>>>> serviceClass="com.project.service.impl.ServiceManagerImpl" />
>>>>
>>>> <cxf:rsClient id="restEndpoint"
>>>> address="http://localhost:8080/services/rest"
>>>> serviceClass="com.project.service.impl.ServiceManagerImpl" />
>>>>
>>>> <route>
>>>> <from uri="cxfrs:bean:restRouter"/>
>>>> <to uri="cxfrs:bean:restEndpoint"/>
>>>> </route>
>>>>
>>>>
>>>> Jejo
>>>>
>>>>
>>>> willem.jiang wrote:
>>>>> It's hard to create the Proxy without specify the ResourceClass.
>>>>> HttpClient API is more friendly, as you don't need to specify the
>>>>> ResourceClass when creating the client.
>>>>>
>>>>> Willem
>>>>>
>>>>> jejmaster wrote:
>>>>>> 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-tp28186748p28207107.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Null parameters when routing CXFRS endpoints
Posted by Willem Jiang <wi...@gmail.com>.
I don't think current Spring DSL support to set the Object[] into
header. I'm afraid you need to use processor or Java DSL to do this job.
Willem
jejmaster wrote:
> Hi Willem,
>
> Thats another good feature. But how do you set the Object[] varValues on
> CxfConstants.CAMEL_CXF_RS_VAR_VALUES message header via spring xml?
>
>
>
> <from uri="cxfrs://bean://rsServer"/>
> <!-- We can remove this configure as the CXFRS producer is using the
> HttpAPI by default -->
> <setHeader headerName="CamelCxfRsVarValues">
> ?
> </setHeader>
> <to uri="cxfrs://bean://rsClient"/>
>
> Or do I still need to create a processor bean class to manually set this?
>
> Regards,
> Jejo
>
>
>
> willem.jiang wrote:
>> Oh. my mistake.
>> If you take a look at the CxfRsProducer.invokeProxyClient(Exchange
>> exchange), you will find you need to set
>> CxfConstants.CAMEL_CXF_RS_VAR_VALUES message header to set the varValues
>> if there are more than one resource class to create a right proxy.
>>
>> Willem
>>
>> jejmaster wrote:
>>> I see. That's great. So you mean the serviceClass parameter is optional
>>> when
>>> configuring cxf? How do you expose the service without specifying the
>>> serviceClass ? Isn't it required configuring at least the cxf:rsServer?
>>>
>>> <cxf:rsServer id="restRouter" address="/restRouter/"
>>> serviceClass="com.project.service.impl.ServiceManagerImpl" />
>>>
>>> <cxf:rsClient id="restEndpoint"
>>> address="http://localhost:8080/services/rest"
>>> serviceClass="com.project.service.impl.ServiceManagerImpl" />
>>>
>>> <route>
>>> <from uri="cxfrs:bean:restRouter"/>
>>> <to uri="cxfrs:bean:restEndpoint"/>
>>> </route>
>>>
>>>
>>> Jejo
>>>
>>>
>>> willem.jiang wrote:
>>>> It's hard to create the Proxy without specify the ResourceClass.
>>>> HttpClient API is more friendly, as you don't need to specify the
>>>> ResourceClass when creating the client.
>>>>
>>>> Willem
>>>>
>>>> jejmaster wrote:
>>>>> 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
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>
>>
>>
>
Re: Null parameters when routing CXFRS endpoints
Posted by jejmaster <je...@gmail.com>.
Hi Willem,
Thats another good feature. But how do you set the Object[] varValues on
CxfConstants.CAMEL_CXF_RS_VAR_VALUES message header via spring xml?
<from uri="cxfrs://bean://rsServer"/>
<!-- We can remove this configure as the CXFRS producer is using the
HttpAPI by default -->
<setHeader headerName="CamelCxfRsVarValues">
?
</setHeader>
<to uri="cxfrs://bean://rsClient"/>
Or do I still need to create a processor bean class to manually set this?
Regards,
Jejo
willem.jiang wrote:
>
> Oh. my mistake.
> If you take a look at the CxfRsProducer.invokeProxyClient(Exchange
> exchange), you will find you need to set
> CxfConstants.CAMEL_CXF_RS_VAR_VALUES message header to set the varValues
> if there are more than one resource class to create a right proxy.
>
> Willem
>
> jejmaster wrote:
>> I see. That's great. So you mean the serviceClass parameter is optional
>> when
>> configuring cxf? How do you expose the service without specifying the
>> serviceClass ? Isn't it required configuring at least the cxf:rsServer?
>>
>> <cxf:rsServer id="restRouter" address="/restRouter/"
>> serviceClass="com.project.service.impl.ServiceManagerImpl" />
>>
>> <cxf:rsClient id="restEndpoint"
>> address="http://localhost:8080/services/rest"
>> serviceClass="com.project.service.impl.ServiceManagerImpl" />
>>
>> <route>
>> <from uri="cxfrs:bean:restRouter"/>
>> <to uri="cxfrs:bean:restEndpoint"/>
>> </route>
>>
>>
>> Jejo
>>
>>
>> willem.jiang wrote:
>>> It's hard to create the Proxy without specify the ResourceClass.
>>> HttpClient API is more friendly, as you don't need to specify the
>>> ResourceClass when creating the client.
>>>
>>> Willem
>>>
>>> jejmaster wrote:
>>>> 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-tp28186748p28202521.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Null parameters when routing CXFRS endpoints
Posted by Willem Jiang <wi...@gmail.com>.
Oh. my mistake.
If you take a look at the CxfRsProducer.invokeProxyClient(Exchange
exchange), you will find you need to set
CxfConstants.CAMEL_CXF_RS_VAR_VALUES message header to set the varValues
if there are more than one resource class to create a right proxy.
Willem
jejmaster wrote:
> I see. That's great. So you mean the serviceClass parameter is optional when
> configuring cxf? How do you expose the service without specifying the
> serviceClass ? Isn't it required configuring at least the cxf:rsServer?
>
> <cxf:rsServer id="restRouter" address="/restRouter/"
> serviceClass="com.project.service.impl.ServiceManagerImpl" />
>
> <cxf:rsClient id="restEndpoint"
> address="http://localhost:8080/services/rest"
> serviceClass="com.project.service.impl.ServiceManagerImpl" />
>
> <route>
> <from uri="cxfrs:bean:restRouter"/>
> <to uri="cxfrs:bean:restEndpoint"/>
> </route>
>
>
> Jejo
>
>
> willem.jiang wrote:
>> It's hard to create the Proxy without specify the ResourceClass.
>> HttpClient API is more friendly, as you don't need to specify the
>> ResourceClass when creating the client.
>>
>> Willem
>>
>> jejmaster wrote:
>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>
>>
>>
>
Re: Null parameters when routing CXFRS endpoints
Posted by jejmaster <je...@gmail.com>.
I see. That's great. So you mean the serviceClass parameter is optional when
configuring cxf? How do you expose the service without specifying the
serviceClass ? Isn't it required configuring at least the cxf:rsServer?
<cxf:rsServer id="restRouter" address="/restRouter/"
serviceClass="com.project.service.impl.ServiceManagerImpl" />
<cxf:rsClient id="restEndpoint"
address="http://localhost:8080/services/rest"
serviceClass="com.project.service.impl.ServiceManagerImpl" />
<route>
<from uri="cxfrs:bean:restRouter"/>
<to uri="cxfrs:bean:restEndpoint"/>
</route>
Jejo
willem.jiang wrote:
>
> It's hard to create the Proxy without specify the ResourceClass.
> HttpClient API is more friendly, as you don't need to specify the
> ResourceClass when creating the client.
>
> Willem
>
> jejmaster wrote:
>> 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-tp28186748p28191256.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Null parameters when routing CXFRS endpoints
Posted by Willem Jiang <wi...@gmail.com>.
It's hard to create the Proxy without specify the ResourceClass.
HttpClient API is more friendly, as you don't need to specify the
ResourceClass when creating the client.
Willem
jejmaster wrote:
> 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
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>
>>
>
Re: Null parameters when routing CXFRS endpoints
Posted by jejmaster <je...@gmail.com>.
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.
Re: Null parameters when routing CXFRS endpoints
Posted by Willem Jiang <wi...@gmail.com>.
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
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>
Re: Null parameters when routing CXFRS endpoints
Posted by Willem Jiang <wi...@gmail.com>.
Hi Jejo,
I just checked the code of CxfRsProducer, the parameter is taken from
the inMessageBody with Object[].class.
Maybe something is wrong with this part of code.
Can you attach a small test case into the JIRA? It will help us to find
a way to resolve this issue quickly.
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
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>
Re: Null parameters when routing CXFRS endpoints
Posted by jejmaster <je...@gmail.com>.
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-tp28186748p28189696.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Null parameters when routing CXFRS endpoints
Posted by jejmaster <je...@gmail.com>.
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-tp28186748p28187620.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Null parameters when routing CXFRS endpoints
Posted by Willem Jiang <wi...@gmail.com>.
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
>
>
>
>
>