PDA

View Full Version : inbound-channel + unmarshalling transformer



srinivas_vsk
Dec 1st, 2009, 11:28 AM
Hi,

I have inbound-channel-adapter polling a directory with xml files. And defined a unmarshalling-transformer for transforming the xml to java.
It appears that the payload from the inbound channel is of type File but the jaxb unmarshaller always expects the input to be streamsource. Is there a better way to handle this, right now im overcoming this by defining a converter service between these channels ?

This is the error without my converter

Caused by: org.springframework.integration.core.MessagingExce ption: Failed to create Source for payload type [java.io.File]
at org.springframework.integration.xml.source.DomSour ceFactory.createSource(DomSourceFactory.java:62)

Thanks
Srinivas

Mark Fisher
Dec 1st, 2009, 11:37 AM
Can you try adding a "file-to-string-transformer" element (as defined in the "file" namespace) between the inbound-channel-adapter and the unmarshalling-transformer?

srinivas_vsk
Dec 1st, 2009, 11:43 AM
Its working with file to string but it would have been nice if it automatically handled the file instance. saves me extra step of configuration.

Thanks
Srinivas

Mark Fisher
Dec 1st, 2009, 11:45 AM
Understood. Can you open a new feature request in JIRA?

Thanks,
Mark

srinivas_vsk
Dec 1st, 2009, 11:55 AM
just did - INT-899

Thanks for your time

Srinivas

Mark Fisher
Dec 1st, 2009, 12:32 PM
I just committed support for File payloads. Please try this as soon as you have a chance and post back here (or in JIRA) with your results. Thanks!