Hello Willem,thank for your answer. Looks that you have right. Let me describe my situation. I have XML file which I want to use together with freemarker. I already tested my XML to call REST web service from SoapUI tool and it works well.*/ws-read.xml/* template: <?xml version="1.0" encoding="UTF-8"?> <ws:GetSubjectRequest xmlns:ws="http://portal.system.com/ws/WS-READ-1.1">${headers.subject}</ws:GetSubjectRequest> How can I use my XML template in Camel? Do I need marshal XML to JSON every time before I call CXFRS component? Or is there any way how to use message body in XML format?There is my context: <camel:camelContext> <camel:dataFormats> <camel:xmljson id="xmljson"/> <camel:xmljson id="xmljsonWithOptions" forceTopLevelObject="true" trimSpaces="true" rootName="newRoot" skipNamespaces="false" removeNamespacePrefixes="false"/> </camel:dataFormats> <camel:route id="timer-to-ws"> <camel:from uri="timer://foo?fixedRate=true&amp;period=4s"/> <camel:setExchangePattern pattern="InOut"/> <camel:setHeader headerName="subject"> <camel:constant>test</camel:constant> </camel:setHeader> <camel:setHeader headerName="CamelCxfRsUsingHttpAPI"> <camel:constant>True</camel:constant> </camel:setHeader> <camel:setHeader headerName="CamelHttpMethod"> <camel:constant>POST</camel:constant> </camel:setHeader> <camel:to uri="freemarker:xml/ws-read.xml"/> <camel:marshal ref="xmljsonWithOptions"/> <camel:to uri="cxfrs://http://192.168.1.93/system/ws-edit/3/call?httpClientAPI=true&amp;synchronous=true"/> <camel:process ref="ldapProcessor"/> </camel:route> </camel:camelContext> and I got this exception: [mel-1) thread #0 - timer://foo] XMLSerializer INFO Using default type string{"ws:GetSubjectRequest":{"@xmlns:ws":"http://portal.system.com/ws/WS-READ-1.1","#text":"test"}} [mel-1) thread #0 - timer://foo] BusApplicationContext INFO Refreshing org.apache.cxf.bus.spring.BusApplicationContext@5d106021: startup date [Tue Nov 06 12:38:23 CET 2012]; parent: Root WebApplicationContext[mel-1) thread #0 - timer://foo] idationXmlBeanDefinitionReader INFO Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml] [mel-1) thread #0 - timer://foo] idationXmlBeanDefinitionReader INFO Loading XML bean definitions from class path resource [META-INF/cxf/camel/cxf-extension-camel.xml] [mel-1) thread #0 - timer://foo] DefaultErrorHandler ERROR Failed delivery for (MessageId: ID-asgard-57144-1352201886004-0-3 on ExchangeId: ID-asgard-57144-1352201886004-0-2). Exhausted after delivery attempt: 1 caught: *java.lang.ClassCastException: java.util.ArrayList cannot be cast to org.apache.cxf.message.MessageContentsList*java.lang.ClassCastException: java.util.ArrayList cannot be cast to org.apache.cxf.message.MessageContentsList at org.apache.camel.component.cxf.jaxrs.DefaultCxfRsBinding.bindCamelMessageBodyToRequestBody(DefaultCxfRsBinding.java:166)[camel-cxf-2.10.2.jar:2.10.2] at org.apache.camel.component.cxf.jaxrs.CxfRsProducer.invokeHttpClient(CxfRsProducer.java:143)[camel-cxf-2.10.2.jar:2.10.2] at org.apache.camel.component.cxf.jaxrs.CxfRsProducer.process(CxfRsProducer.java:87)[camel-cxf-2.10.2.jar:2.10.2] at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[camel-core-2.10.2.jar:2.10.2] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.2.jar:2.10.2] at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)[camel-core-2.10.2.jar:2.10.2] at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)[camel-core-2.10.2.jar:2.10.2] at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)[camel-core-2.10.2.jar:2.10.2] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.2.jar:2.10.2] at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.2.jar:2.10.2]
How should I set message body and in which format? -- View this message in context: http://camel.465427.n5.nabble.com/CXFRS-Producer-tp5722162p5722212.html Sent from the Camel - Users mailing list archive at Nabble.com.
