You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by edhansen42 <ed...@vsp.com> on 2014/06/29 19:33:34 UTC

Mangled headers on CXFRS request

I am using Camel version 2.11.1, and CXF version 2.7.8.

I am trying to use the cxfrs component to submit a request to a rest service
from camel.  I am invoking the route that makes the cxfrs call via a proxy
and have a processor that sets up the headers - bi is the BeanInvocation
object from the proxy - token is a string.  Here is the processor:

		exchange.setPattern(ExchangePattern.InOut);
		exchange.getIn().setBody(null);
		exchange.getIn().getHeaders().clear();
		exchange.getIn().setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
Boolean.FALSE);
		exchange.getIn().setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS,
bi.getMethod().getReturnType());
		exchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
bi.getMethod().getName());
		exchange.getIn().setHeader(HttpHeaders.AUTHORIZATION, token);
		exchange.getIn().setHeader(Exchange.ACCEPT_CONTENT_TYPE,
"application/vnd.company.foo+json"");
		exchange.getIn().setHeader(Exchange.CONTENT_TYPE,
"application/vnd.company.foo+json")
		exchange.getIn().setBody(bi.getArgs());

When the request is received downstream, the authorization header is
missing, and the camelacceptcontenttype and contenttype headers' values are
changed from what I set to 'application/xml'.

Wondering if I'm doing something wrong, or if there is an issue with the
version of Camel and CXF I'm using.




--
View this message in context: http://camel.465427.n5.nabble.com/Mangled-headers-on-CXFRS-request-tp5753012.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mangled headers on CXFRS request

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Willem, thanks for your help on this issue,
Sergey
On 03/07/14 08:23, Willem Jiang wrote:
> Hi Sergey,
>
> I will take care of this issue :)
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
> On June 30, 2014 at 5:24:05 PM, Sergey Beryozkin (sberyozkin@gmail.com) wrote:
>> Hi Willem, thanks for identifying the issue, I've created
>>
>> https://issues.apache.org/jira/browse/CAMEL-7557
>>
>> I can do a patch or if you have some time then please do a quick fix
>>
>> Cheers, Sergey
>>
>> On 30/06/14 07:27, Willem Jiang wrote:
>>> I just checked the code of CxfRsProducer, it doesn’t copy the message headers from Camel
>> message to CXF message if you invoke the service in proxy model.
>>> Did you try to use HTTP_API to send the request, CxfRsProducer copies the Camel message
>> headers to CXF message in HTTP_API model.
>>>
>>> --
>>> Willem Jiang
>>>
>>> Red Hat, Inc.
>>> Web: http://www.redhat.com
>>> Blog: http://willemjiang.blogspot.com (English)
>>> http://jnn.iteye.com (Chinese)
>>> Twitter: willemjiang
>>> Weibo: 姜宁willem
>>>
>>>
>>>
>>> On June 30, 2014 at 9:33:05 AM, edhansen42 (edha@vsp.com) wrote:
>>>> I am using Camel version 2.11.1, and CXF version 2.7.8.
>>>>
>>>> I am trying to use the cxfrs component to submit a request to a rest service
>>>> from camel. I am invoking the route that makes the cxfrs call via a proxy
>>>> and have a processor that sets up the headers - bi is the BeanInvocation
>>>> object from the proxy - token is a string. Here is the processor:
>>>>
>>>> exchange.setPattern(ExchangePattern.InOut);
>>>> exchange.getIn().setBody(null);
>>>> exchange.getIn().getHeaders().clear();
>>>> exchange.getIn().setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
>>>> Boolean.FALSE);
>>>> exchange.getIn().setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS,
>>>> bi.getMethod().getReturnType());
>>>> exchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
>>>> bi.getMethod().getName());
>>>> exchange.getIn().setHeader(HttpHeaders.AUTHORIZATION, token);
>>>> exchange.getIn().setHeader(Exchange.ACCEPT_CONTENT_TYPE,
>>>> "application/vnd.company.foo+json"");
>>>> exchange.getIn().setHeader(Exchange.CONTENT_TYPE,
>>>> "application/vnd.company.foo+json")
>>>> exchange.getIn().setBody(bi.getArgs());
>>>>
>>>> When the request is received downstream, the authorization header is
>>>> missing, and the camelacceptcontenttype and contenttype headers' values are
>>>> changed from what I set to 'application/xml'.
>>>>
>>>> Wondering if I'm doing something wrong, or if there is an issue with the
>>>> version of Camel and CXF I'm using.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context: http://camel.465427.n5.nabble.com/Mangled-headers-on-CXFRS-request-tp5753012.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>
>>
>>
>>
>


Re: Mangled headers on CXFRS request

Posted by Willem Jiang <wi...@gmail.com>.
Hi Sergey,

I will take care of this issue :) 

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On June 30, 2014 at 5:24:05 PM, Sergey Beryozkin (sberyozkin@gmail.com) wrote:
> Hi Willem, thanks for identifying the issue, I've created
>  
> https://issues.apache.org/jira/browse/CAMEL-7557
>  
> I can do a patch or if you have some time then please do a quick fix
>  
> Cheers, Sergey
>  
> On 30/06/14 07:27, Willem Jiang wrote:
> > I just checked the code of CxfRsProducer, it doesn’t copy the message headers from Camel  
> message to CXF message if you invoke the service in proxy model.
> > Did you try to use HTTP_API to send the request, CxfRsProducer copies the Camel message  
> headers to CXF message in HTTP_API model.
> >
> > --
> > Willem Jiang
> >
> > Red Hat, Inc.
> > Web: http://www.redhat.com
> > Blog: http://willemjiang.blogspot.com (English)
> > http://jnn.iteye.com (Chinese)
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> >
> >
> > On June 30, 2014 at 9:33:05 AM, edhansen42 (edha@vsp.com) wrote:
> >> I am using Camel version 2.11.1, and CXF version 2.7.8.
> >>
> >> I am trying to use the cxfrs component to submit a request to a rest service
> >> from camel. I am invoking the route that makes the cxfrs call via a proxy
> >> and have a processor that sets up the headers - bi is the BeanInvocation
> >> object from the proxy - token is a string. Here is the processor:
> >>
> >> exchange.setPattern(ExchangePattern.InOut);
> >> exchange.getIn().setBody(null);
> >> exchange.getIn().getHeaders().clear();
> >> exchange.getIn().setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
> >> Boolean.FALSE);
> >> exchange.getIn().setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS,
> >> bi.getMethod().getReturnType());
> >> exchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
> >> bi.getMethod().getName());
> >> exchange.getIn().setHeader(HttpHeaders.AUTHORIZATION, token);
> >> exchange.getIn().setHeader(Exchange.ACCEPT_CONTENT_TYPE,
> >> "application/vnd.company.foo+json"");
> >> exchange.getIn().setHeader(Exchange.CONTENT_TYPE,
> >> "application/vnd.company.foo+json")
> >> exchange.getIn().setBody(bi.getArgs());
> >>
> >> When the request is received downstream, the authorization header is
> >> missing, and the camelacceptcontenttype and contenttype headers' values are
> >> changed from what I set to 'application/xml'.
> >>
> >> Wondering if I'm doing something wrong, or if there is an issue with the
> >> version of Camel and CXF I'm using.
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context: http://camel.465427.n5.nabble.com/Mangled-headers-on-CXFRS-request-tp5753012.html  
> >> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>
> >
>  
>  
>  


Re: Mangled headers on CXFRS request

Posted by edhansen42 <ed...@vsp.com>.
Thanks guys - I'd rather stick with the proxy model, so I'll wait for the
patch.



--
View this message in context: http://camel.465427.n5.nabble.com/Mangled-headers-on-CXFRS-request-tp5753012p5753069.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mangled headers on CXFRS request

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Willem, thanks for identifying the issue, I've created

https://issues.apache.org/jira/browse/CAMEL-7557

I can do a patch or if you have some time then please do a quick fix

Cheers, Sergey

On 30/06/14 07:27, Willem Jiang wrote:
> I just checked the code of CxfRsProducer, it doesn’t copy the message headers from Camel message to CXF message if you invoke the service in proxy model.
> Did you try to use HTTP_API to send the request, CxfRsProducer copies the Camel message headers to CXF message in HTTP_API model.
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
> On June 30, 2014 at 9:33:05 AM, edhansen42 (edha@vsp.com) wrote:
>> I am using Camel version 2.11.1, and CXF version 2.7.8.
>>
>> I am trying to use the cxfrs component to submit a request to a rest service
>> from camel. I am invoking the route that makes the cxfrs call via a proxy
>> and have a processor that sets up the headers - bi is the BeanInvocation
>> object from the proxy - token is a string. Here is the processor:
>>
>> exchange.setPattern(ExchangePattern.InOut);
>> exchange.getIn().setBody(null);
>> exchange.getIn().getHeaders().clear();
>> exchange.getIn().setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
>> Boolean.FALSE);
>> exchange.getIn().setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS,
>> bi.getMethod().getReturnType());
>> exchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
>> bi.getMethod().getName());
>> exchange.getIn().setHeader(HttpHeaders.AUTHORIZATION, token);
>> exchange.getIn().setHeader(Exchange.ACCEPT_CONTENT_TYPE,
>> "application/vnd.company.foo+json"");
>> exchange.getIn().setHeader(Exchange.CONTENT_TYPE,
>> "application/vnd.company.foo+json")
>> exchange.getIn().setBody(bi.getArgs());
>>
>> When the request is received downstream, the authorization header is
>> missing, and the camelacceptcontenttype and contenttype headers' values are
>> changed from what I set to 'application/xml'.
>>
>> Wondering if I'm doing something wrong, or if there is an issue with the
>> version of Camel and CXF I'm using.
>>
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Mangled-headers-on-CXFRS-request-tp5753012.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>



Re: Mangled headers on CXFRS request

Posted by Willem Jiang <wi...@gmail.com>.
I just checked the code of CxfRsProducer, it doesn’t copy the message headers from Camel message to CXF message if you invoke the service in proxy model. 
Did you try to use HTTP_API to send the request, CxfRsProducer copies the Camel message headers to CXF message in HTTP_API model.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On June 30, 2014 at 9:33:05 AM, edhansen42 (edha@vsp.com) wrote:
> I am using Camel version 2.11.1, and CXF version 2.7.8.
>  
> I am trying to use the cxfrs component to submit a request to a rest service
> from camel. I am invoking the route that makes the cxfrs call via a proxy
> and have a processor that sets up the headers - bi is the BeanInvocation
> object from the proxy - token is a string. Here is the processor:
>  
> exchange.setPattern(ExchangePattern.InOut);
> exchange.getIn().setBody(null);
> exchange.getIn().getHeaders().clear();
> exchange.getIn().setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
> Boolean.FALSE);
> exchange.getIn().setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS,
> bi.getMethod().getReturnType());
> exchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
> bi.getMethod().getName());
> exchange.getIn().setHeader(HttpHeaders.AUTHORIZATION, token);
> exchange.getIn().setHeader(Exchange.ACCEPT_CONTENT_TYPE,
> "application/vnd.company.foo+json"");
> exchange.getIn().setHeader(Exchange.CONTENT_TYPE,
> "application/vnd.company.foo+json")
> exchange.getIn().setBody(bi.getArgs());
>  
> When the request is received downstream, the authorization header is
> missing, and the camelacceptcontenttype and contenttype headers' values are
> changed from what I set to 'application/xml'.
>  
> Wondering if I'm doing something wrong, or if there is an issue with the
> version of Camel and CXF I'm using.
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mangled-headers-on-CXFRS-request-tp5753012.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>