0
votes

I am using apache camel with spring and spring dsl . Trying to route from cxfrs bean to a servlet based on a header parameter. below is the camel route configuration

<camelContext xmlns="http://camel.apache.org/schema/spring">

        <route>
            <from uri="cxfrs://bean://service?bindingStyle=SimpleConsumer" />
            <to uri="log:body?level=INFO" />
            <camel:filter>
                <camel:simple>${in.header.export} == true</camel:simple>
                <setProperty propertyName="exchange">
                <camel:spel>#{exchange}</camel:spel>
                </setProperty>
                <camel:to uri="http://localhost:8080/service/Reports?exchange=${property.exchange}&amp;bridgeEndpoint=true"/>
            </camel:filter>
            <to uri="bean:businessDelegate" />
        </route>

problem is that the JSON payload from the service is not getting transferred to the http servlet . below is the web xml

    <servlet>
        <display-name>ReportServlet</display-name>
        <servlet-name>ReportServlet</servlet-name>
        <servlet-class>
            org.springframework.web.context.support.HttpRequestHandlerServlet
        </servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>ReportServlet</servlet-name>
        <url-pattern>/Reports/*</url-pattern>
    </servlet-mapping>          
  <servlet>
    <servlet-name>CXFServlet</servlet-name>
    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

pls help. How to transfer the exchange body from the initial request to the Servlet? The servlet's http request headers and parameters are empty.

1

1 Answers

0
votes

Likely its due to logging the message body which causes an empty body. See this FAQ: http://camel.apache.org/why-is-my-message-body-empty.html