I am trying to route a rest request from a cxf rest service to another. I have had a look at http://camel.apache.org/cxfrs.html which helped understand part of the process. I have a classCastException at the level of the remoteService Invocation.

What am I doing wrong ?

<cxf:rsServer id="exposedService" address="/exposed/"
serviceClass="com.example.project.ExposedService" />

<!-- using different classes since we are not just proxying -->
<cxf:rsClient id="remoteService" address="http://remote.com/service"
serviceClass="com.example.project.RemoteService" />

<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
   <package>com.example.project</package>
</camel:camelContext>

Service Classes:

@Path("/myservice")
public class ExposedService {

    @POST
        @Consumes("application/xml")
    public void postResource(javax.xml.transform.Source resource) {
            // source : not using jaxb just plain xml
        // only serves to configure the endpoint (?)    
    }               
}


public class RemoteService {

    @POST
        @Consumes("application/xml")
    public void postResource(javax.xml.transform.Source resource) {
            // source : not using jaxb just plain xml
        // only serves to configure the endpoint (?)    
    }               
}

RouteBuilder:

public class MyRouteBuilder extends RouteBuilder {

public void configure() { 
    from("cxfrs://bean://exposedService")
    .process(...) // a few System.out.println's
    .to("cxfrs://bean://remoteService")
    ;   
}
}

Stacktrace:

| ERROR | qtp-2045010446-1 | DefaultErrorHandler              | 68 - org.apache.camel.camel-core - 2.6
Edit
Report