You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Calvert, Zach (Zach)** CTR **" <zc...@motive.com> on 2012/03/23 22:46:55 UTC

Camel CXF Drops Headers

I have a problem where my message headers are being dropped.  The route looks like

        <camel:route>
            <camel:from uri="jetty:http://0.0.0.0:{{jetty.port}}/rest/?matchOnUriPrefix=true" />
            <camel:log message="Message received from jetty"/>
            <camel:to uri="cxfbean:restfulService?headerFilterStrategy=#keepAllMessageHeadersStrategy" />
            <camel:log message="Message updated after CXF"/> <!-at this point, the headers are gone -->
            <camel:to uri="bean:parser?method=handleHeaders" />
        </camel:route>

Now I've been trying to keep ALL of the headers via configuring a header filter strategy, but it doesn't seem to have any impact:

    <bean id="keepAllMessageHeadersStrategy" name="keepAllMessageHeadersStrategy" class="org.apache.camel.component.cxf.CxfHeaderFilterStrategy">
        <!--  Set relayHeaders to false to drop all SOAP headers -->
        <property name="relayAllMessageHeaders" value="true"/>
        <property name="relayHeaders" value="false"/>
    </bean>

<!-parsing details:-->
<bean id="parser" name="parser" class="motive.Parser">
    </bean>
    <util:list id="restfulService">
        <ref bean="parser"/>
    </util:list>

I have tried relayAllMessageHeaders set to both true/false and all permutations with relayHeaders being set to true/false.  My CXF bean doesn't do anything other than parse the Body.  Directly after calling to the cxfbean, all of the headers are dropped.  Now I'm using Camel 2.6.0, so I'm a bit behind the times, but the docs still seem to apply and I haven't found any bugs that look to be triggering issues with my efforts.  The CxfHeaderFilterStrategy is definitely being applied because I get exceptions/errors if I remove the "#" symbol, but it doesn't seem to have any impact.

Can someone tell me what I need to do to keep ALL of my headers after the cxfbean call?



Thanks,
Zach Calvert

Re: Camel CXF Drops Headers

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

I just checked the code of CxfBeanDestination, it doesn't copy the 
headers from the Camel in message to out message.
I think we could do the same thing as CAMEL-2397[2]does, so I just fill 
a JIRA[2] for it.

If you want to keep those headers in the old version of camel, you need 
to put the headers into a map and put this map into message header with 
the key "org.apache.cxf.message.PROTOCOL_HEADERS".

[1]https://issues.apache.org/jira/browse/CAMEL-2397
[2]https://issues.apache.org/jira/browse/CAMEL-5115

On Sat Mar 24 05:46:55 2012, Calvert, Zach (Zach)** CTR ** wrote:
> I have a problem where my message headers are being dropped.  The route looks like
>
>          <camel:route>
>              <camel:from uri="jetty:http://0.0.0.0:{{jetty.port}}/rest/?matchOnUriPrefix=true" />
>              <camel:log message="Message received from jetty"/>
>              <camel:to uri="cxfbean:restfulService?headerFilterStrategy=#keepAllMessageHeadersStrategy" />
>              <camel:log message="Message updated after CXF"/>  <!-at this point, the headers are gone -->
>              <camel:to uri="bean:parser?method=handleHeaders" />
>          </camel:route>
>
> Now I've been trying to keep ALL of the headers via configuring a header filter strategy, but it doesn't seem to have any impact:
>
>      <bean id="keepAllMessageHeadersStrategy" name="keepAllMessageHeadersStrategy" class="org.apache.camel.component.cxf.CxfHeaderFilterStrategy">
>          <!--  Set relayHeaders to false to drop all SOAP headers -->
>          <property name="relayAllMessageHeaders" value="true"/>
>          <property name="relayHeaders" value="false"/>
>      </bean>
>
> <!-parsing details:-->
> <bean id="parser" name="parser" class="motive.Parser">
>      </bean>
>      <util:list id="restfulService">
>          <ref bean="parser"/>
>      </util:list>
>
> I have tried relayAllMessageHeaders set to both true/false and all permutations with relayHeaders being set to true/false.  My CXF bean doesn't do anything other than parse the Body.  Directly after calling to the cxfbean, all of the headers are dropped.  Now I'm using Camel 2.6.0, so I'm a bit behind the times, but the docs still seem to apply and I haven't found any bugs that look to be triggering issues with my efforts.  The CxfHeaderFilterStrategy is definitely being applied because I get exceptions/errors if I remove the "#" symbol, but it doesn't seem to have any impact.
>
> Can someone tell me what I need to do to keep ALL of my headers after the cxfbean call?
>
>
>
> Thanks,
> Zach Calvert
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang