L.S,

You can write your own class that implements the FileMarshaler interface (or better: extend from DefaultFileMarshaler) and override the writeMessage() method. Within this method, you can then write code to output the XML message as a flat file. You can also override the getOutputName() method to determine the output file name.

Afterwards, you specify the class you've written as the marshaler using the marshaler="..." attribute on the <file:sender /> element.

Regards,

Gert

goldi wrote:
Hello everybody,
is it possible using the file sender component without to create an
xml-file? I just need a simple file without any xml specific tags. I always
get a file like:

<?xml version="1.0" encoding="UTF-8"?>
<hello>myContent
</hello>

but I just want a file like this:

myContent


I'm calling the file sender with the Client API like this:

InOnly exchange = client.createInOnlyExchange();

NormalizedMessage message = exchange.getInMessage();
message.setProperty("name", "James");
message.setContent(new StreamSource(new
StringReader("<hello>myContent</hello>")));

QName service = new QName("http://servicemix.org/file/";, "fileSender");
exchange.setService(service);
client.send(exchange);

my file sender looks like this:

 <file:sender service="fH:fileWriter" endpoint="fileWriter"
directory="file:Output/">
        <file:marshaler>
                <sm:defaultFileMarshaler>
                        <sm:fileName>
                        <sm:xpathString xpath="concat($name, '.txt')"/>
                        </sm:fileName>
                </sm:defaultFileMarshaler>
        </file:marshaler>
</file:sender>

The problem is that I can't use a message content like this:

message.setContent(new StreamSource(new StringReader(myContent)));

because then I'm getting an exception.

greets Goldi







Reply via email to