camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Liu <Gary.Liu1...@gmail.com>
Subject Re: Problem from Java DSL to Spring DSL
Date Wed, 15 May 2013 13:28:33 GMT
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.

Mime
View raw message