You need to create a OutputReportIncident as the response, you can do this from xml with
<bean id="ok" class="... OutputReportIncident"> <constructor-arg ...> </bean> And then in the Camel xml route, then refer to this bean as the body <transform> <simple>ref:ok</simple> </transform> On Wed, May 15, 2013 at 3:28 PM, Gary Liu <gary.liu1...@gmail.com> wrote: > Thanks Claus! The following code works. > > <camel:setHeader headerName="Exchange.FILE_NAME"> > > <camel:constant>request-${date:now:yyyy-MM-dd-HHmmssSSS}</camel:constant> > </camel:setHeader> > > > I still don't understand how the following Java DSL works, i mean > "transform" part : > from("cxf:bean:reportIncident") > .convertBodyTo(InputReportIncident.class) > .setHeader(Exchange.FILE_NAME, > constant("request-${date:now:yyyy-MM-dd-HHmmssSSS}")) > .wireTap("file://target/inbox/") > .choice().when(simple("${body.givenName} == 'Claus'")) > .transform(constant(ok)) > .otherwise() > .bean(new ReportIncidentImpl(), "doReportIncident") > .transform(constant(accepted) > > ); > > > To me transform(constant(ok)) will return a string "ok", but client is > expect OutputReportIncident. Of course, the Java DSL works, and my > translation of Spring DSL did not work. Why? > > I created a bean: > @Override > @WebResult(name = "outputReportIncident", targetNamespace = > "http://reportincident.example.camel.apache.org", partName = "out") > @WebMethod(action = > "http://reportincident.example.camel.apache.org/ReportIncident") > public OutputReportIncident doReportIncident( > @WebParam(partName = "in", name = > "inputReportIncident", targetNamespace > = "http://reportincident.example.camel.apache.org") InputReportIncident in) > { > // TODO Auto-generated method stub > > System.out.println("==================================================="); > System.out.println(in.familyName); > // in.setGivenName("IChangeIt"); > OutputReportIncident output = new OutputReportIncident(); > if(in.getGivenName().equalsIgnoreCase("Claus")){ > output.setCode("OK"); > } else { > output.setCode("Accepted"); > } > return output; > } > > That works. > > What have I missed? > > Thanks, > --Gary > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Problem-from-Java-DSL-to-Spring-DSL-tp5732558p5732613.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- www.camelone.org: The open source integration conference. Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen