camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashwin Karpe <>
Subject Re: Extracting request IP in Camel CXF
Date Thu, 23 Dec 2010 03:28:52 GMT


If the IP address is in a SOAP Header, can you please try the following

1. Add a HeaderFilterStrategy bean in camel-context.xml as shown below

<bean id="foobar"
    <property name="relayAllMessageHeaders" value="true"/>

2. Add this id to your camel-cxf endpoint as shown below

	<camel:route id="wsXmlMessagesRoute">
			<camel:from uri="cxf:bean:wsEndpoint?headerFilterStrategy=#foobar" />
			<camel:process ref="testProcessor"/>
			<camel:inOnly uri="file://test_files" />

You might want to check out the section "Changes since Release 2.0" in the
documentation  It covers in-band and out-of-band headers
and how they are propagated in camel-cxf.

BTW, I checked out the code in 2.5.0 and it should be passing along the
headers. I suspect based on the fact that the MessageContentList Header
entry is an empty list that CXF is for some reason not passing headers

I am not sure if the IP address is passed in the HTTP headers and not SOAP
Headers. If so, the way to get at an IP address embedded in HTTP headers
surrounding the SOAP Headers, however this involves instantiating a CXF bus
object, adding an in-interceptor in the PRE_STREAM phase to get at the
header before it is stripped by CXF and injecting the bus object into the
camel-cxf consumer endpoint as shown below.

<camel:from uri="cxf:bean:wsEndpoint?&bus=#myCustomBus" /> 

If what you are looking to accomplish is to allow/disallow requests based on
IP address, the interceptor should do the trick. Just throw a remote
exception in the interceptor if the address does not match. Else you can add
a IP address as a new header to the SOAP Message Header in the interceptors
and then you should see the header in the processor.

For more details on creating CXF interceptors check out 

Phew.... Rather long answer. Hope this helps.



Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary) 

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message