Hi You can set the header Exchange.BEAN_METHOD_NAME on the Exchange and then invoke a bean. The bean could then have the same method names as the CXF. Then Camel will pick the appropriate method.
You may even just copy the CXF operations header to the method name header. from(cxf) .setHeader(Exchange.BEAN_METHOD_NAME, header(CxfConstants.OPXXX) .to(bean:someBean); On Tue, Jul 20, 2010 at 10:23 AM, Bruno Dusausoy <bdusau...@yp5.be> wrote: > Hi, > > I'm a little confused by the use of a processor when consuming message (in > POJO mode) from a CXF endpoint. > Basically, what I want to do is consuming messages from the latter : just > knowing what the operation is and do some processing depending on it, > returning the result to the caller (the producer) and then let the message > continue its journey through the routes I've configured. > > public class CareerRouteBuilder extends SpringRouteBuilder { > > // ... > �...@override > public void configure() throws Exception { > > from("cxf://bean:myService").process(new Processor() { > public void process(Exchange exchange) throws Exception { > String operation = > exchange.getIn().getHeader(CxfConstants.OPERATION_NAME, String.class); > /* > * Maybe I could use reflection on a bean implementing the > interface > * automatically generated by CXF's codegen-maven-plugin > instead of using "if" statements. > */ > if (operation.equals("SomeOperation")) { > MyResponse res = > someBean.process(exchange.getIn().getBody(SomeClazz.class); > exchange.getOut().setBody(res); > } else if (operation.equals("AnotherOperation")) { > // ... > } else { > // ... > } > } > }); > } > } > > It works fine, but is it the best way to do what I want ? > Of course I could also use CXF directly and then route manually the result > to the desired endpoint. > But it would definitely be nicer if I could directly use a bean to process > the desired operation. > I've read the CXF Component documentation but haven't found anything like > this. > Am I missing something ? > > Regards. > -- > Bruno Dusausoy > YP5 Software > -- > Pensez environnement : limitez l'impression de ce mail. > Please don't print this e-mail unless you really need to. > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus