Shishir, I've had exactly the same experience that you have had. It's not the filename or extension, but the content of the file. As long as the file (regardless of name) contains a valid XML message, everything is OK. Based on my evaluation of the code, the DefaultFileMarshaler is reading the XML and converting it to a normalized message. If you want to read different types of files, you'd need to write a new FileMarhaler.
Can anyone please confirm this? Stephen Ferrando [EMAIL PROTECTED] 212-480-4112 x5800 www.dbconcert.com -----Original Message----- From: Shishir K. Singh [mailto:[EMAIL PROTECTED] Sent: Thursday, September 08, 2005 2:24 PM To: [email protected] Subject: RE: [servicemix-user] Binary Files: How to ? -----Original Message----- From: news [mailto:[EMAIL PROTECTED] On Behalf Of David Fry Sent: Thursday, September 08, 2005 1:47 PM To: [email protected] Subject: Re: [servicemix-user] Binary Files: How to ? Shishir K. Singh wrote: > Hi, > > I am playing with the file component (examples : file-binding). It > works fine if I use the test-file.xml that is provided in the example. > > However, it does not seem to work when I remove or change > JaxenStringXPathExpression to ConstantExpression in servicemix.xml and > then usea txt file or xls file. > > Am I misisng something. Also, how can I move around a binary file ? > > Any hints /tips will be appreciated. > > Thanks > Shishir > >>Try this: >><bean class="org.servicemix.components.util.DefaultFileMarshaler"> >> <property name="fileName"> >> <bean >>class="org.servicemix.expression.ConstantExpression"> >> <constructor-arg value="yourFilename.ext"/> >> </bean> >> </property> >> </bean> Thanks..however as I have said earlier, I have already tried using the ConstantExpression. <component id="fileSender" service="foo:fileSender" class="org.servicemix.components.file.FileWriter"> <property name="directory" value="outbox"/> <property name="marshaler"> <bean class="org.servicemix.components.util.DefaultFileMarshaler"> <property name="fileName"> <bean class="org.servicemix.expression.ConstantExpression"> <constructor-arg value="test.ext"/> </bean> </property> </bean> </property> </component> The results that I get with different files are : a) test-file.xml ---> Works fine b) test.txt (simple text file with one line) --> The file gets copied over in the outbox with 0 bytes and get a fatal error message :[Fatal Error] test.txt:1:1: Content is not allowed in prolog. c) text.xls (Microsoft xl file) --> The one also gets copied over to outbox but again with 0 bytes. So , again the question is, am I missing something in terms of any settings for cases where I need to move around files other than pure xml files. Do I need to write my own marshaller to do this kind of work. Need to dive in the code to figure out why this is happening. However, will appreciate it, if anyone can suggest something off the top of the head. Thanks Shishir
