Hi,

I have written this route:


from("quartz:Export?cron=" + prop.getProperty("export.schedule"))
.setHeader(Exchange.HTTP_QUERY, constant("query=" +
URLEncoder.encode(prop.getProperty("query.for.import.request"), "UTF-8")))
.to("http:{{server.hostname}}:{{server.port}}/{{server.context.path}}/search.ws")
    .log("Got export from XXX")
    .wireTap("file:tmp/exportDump")
.removeHeaders("CamelHttp*")                    
.convertBodyTo(javax.xml.transform.Source.class).to("xslt:/xslt/Entityset2ImportRequest.xsl")
    .log("Converted Entityset to Import Request")
    .wireTap("file:tmp/importDump")
.to("messageSigner")
    .log("Signed the message")
.setHeader(Exchange.HTTP_METHOD,
constant(org.apache.camel.component.http.HttpMethods.POST))
.to("{{url}}")
    .log("Called WebService with result: ${body}");


With small test data this route worked without the wireTaps and the
.convertBodyTo(javax.xml.transform.Source.class). When I tested with larger
amount of data, the processing failed. So I added the wireTaps to write the
messages to file for debugging. (Trace does not output the entire file) So
this was the first exception I hit into:

FINEST|5240/0|11-04-19 12:18:00|org.apache.camel.ExpectedBodyTypeException:
Could not extract IN message body as type: interface
javax.xml.transform.Source body is:
org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream@15e0638

So then I added the .convertBodyTo(javax.xml.transform.Source.class) to
convert from the WrappedInputStream to what the XSLT component expects to
get. 

I compiled and tested. This is the result I got:

FINEST|652/0|11-04-19 12:46:00|net.sf.saxon.trans.XPathException:
org.xml.sax.SAXParseException: Element type "stringES1TUO09D" must be
followed by either attribute specifications, ">" or "/>".

The input message was corrupted. But I suspect Camel corrupted the message
as when I manually export the data, it is correct. I have repeatedly tested
our system and the fault is not there.

I added a delayer to slow things down: Delayer is enabled with: 500 ms.
I restarted and run again: 

FINEST|1844/0|11-04-19 13:08:03|org.apache.camel.InvalidPayloadException: No
body available of type: javax.xml.transform.Source but has value:
org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream@1ea6a1c
of type:
org.apache.camel.converter.stream.CachedOutputStream.WrappedInputStream on:
Message: [Body is instance of java.io.InputStream]. Caused by: No type
converter available to convert from type:
org.apache.camel.converter.stream.CachedOutputStream.WrappedInputStream to
the required type: javax.xml.transform.Source with value
org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream@1ea6a1c.
Exchange[Message: [Body is instance of java.io.InputStream]]. Caused by:
[org.apache.camel.NoTypeConversionAvailableException - No type converter
available to convert from type:
org.apache.camel.converter.stream.CachedOutputStream.WrappedInputStream to
the required type: javax.xml.transform.Source with value
org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream@1ea6a1c]


What am I doing wrong?

-Atte

--
View this message in context: 
http://camel.465427.n5.nabble.com/Weird-behaviour-with-message-routing-tp4312978p4312978.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to