0

I have a problem with removing the "Host" and "org.apache.cxf.request.uri" headers from the In Message in camel exchange. I'm using a cxfrs client to call a rest end point. But before calling that I used removeHeaders tag and removed some unnecessary headers from the exchange. Some of the headers are removed. But I was unable to remove "Host" and "org.apache.cxf.request.uri" headers. They are temporarily removed from the flow just after the removeHeaders call. But they appear in the request call headers when calling using the cxf rs client. Following is a sample from my scenario.

............................... .............................. ${property.asd} == true && ${property.afd} == true

                        **<to uri="direct:removeUnnecessaryHeaders" />**

                        <setHeader headerName="CamelCxfRsUsingHttpAPI">
                            <constant>true</constant>
                        </setHeader>

                        <setHeader headerName="CamelHttpMethod">
                            <constant>PUT</constant>
                        </setHeader>

                        <setHeader headerName="CamelHttpPath">
                            <constant>/partner/managepartnerprofile</constant>
                        </setHeader>

                        <to uri="cxfrs:bean:aclient"/>
                    </when>

.................................. .................................

**<route>
            <from uri="direct:removeUnnecessaryHeaders" />
            <removeHeaders pattern="CamelCxfRsResponseGenericType|org.apache.cxf.request.uri|CamelCxfMessage|CamelHttpResponseCode|Host" />
        </route>**
SachinD
  • 43
  • 1
  • 8

1 Answers1

0

I just did some test and found out these headers was suppose to tell CXF how to build the request with WebClient and them should not be treated as the HTTP protocol headers.

You can use camel-http or camel-http4 endpoint if you don't want to send the those headers to the server.

Willem Jiang
  • 3,291
  • 1
  • 14
  • 14