Hi Is FileCreationStatus annotated with JAXB annotations. If so you should be able to add camel-jaxb to the classpath and then Camel should be able to transform that POJO class to XML via JAXB and write to the file.
So try adding camel-jaxb as dependency so its on the classpath On Sat, Sep 15, 2018 at 2:03 PM Wang Yan <wyan...@gmail.com> wrote: > > I try to save soap request (jaxb payload) to file as xml payload in apache > camel via below code, but it failed. anyone know how to do it? Any hints > will be more than welcome! > > public class CamelRouteBuilder extends RouteBuilder { > > private static final String SOAP_ENDPOINT_URI = > "cxf://http://localhost:{{soapEndpointPort}}/soap" + > "?serviceClass=org.yw.springbootcamelesb.soap.CreateFileService"; > > @Override > public void configure() throws Exception { > from(SOAP_ENDPOINT_URI).process(new > CreateFileProcessor()).to("file:target/reports");; > } > } > > exception I got is like below > > pringbootcamelesb.soap.FileCreationStatus on: > Message[ID-YandeMBP-1536989276152-2-2]. Caused by: No type converter > available to convert from type: > org.yw.springbootcamelesb.soap.FileCreationStatus to the required type: > java.io.InputStream with value > org.yw.springbootcamelesb.soap.FileCreationStatus@75ec37c5. > Exchange[ID-YandeMBP-1536989276152-2-1]. Caused by: > [org.apache.camel.NoTypeConversionAvailableException - No type converter > available to convert from type: > org.yw.springbootcamelesb.soap.FileCreationStatus to the required type: > java.io.InputStream with value > org.yw.springbootcamelesb.soap.FileCreationStatus@75ec37c5] at > org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:117) > ~[camel-core-2.22.0.jar:2.22.0] at > org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:333) > ~[camel-core-2.22.0.jar:2.22.0] ... 40 common frames omitted -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2