You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by goldi <go...@freenet.de> on 2007/05/09 10:46:01 UTC

Using File Sender Component!

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






-- 
View this message in context: http://www.nabble.com/Using-File-Sender-Component%21-tf3714475s12049.html#a10390543
Sent from the ServiceMix - User mailing list archive at Nabble.com.


RE: Using File Sender Component!

Posted by goldi <go...@freenet.de>.
Thanks for fast replies.


rabi wrote:
> 
> 
> I think you can also use and XSLT SE to transform the XML to flat
> structure. 
> 
> 
> Regards,
> Rabi Mishra, 
> Wipro Technologies,Office: +91-20-39104549, VOIP:842
> 2545,CELL+91(0)9890363765  
> http://rabisblog.blogspot.com/
> -----Original Message-----
> From: Gert Vanthienen [mailto:gert.vanthienen@skynet.be] 
> Sent: Wednesday, May 09, 2007 4:50 PM
> To: servicemix-users@geronimo.apache.org
> Subject: Re: Using File Sender Component!
> 
> 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
>>
>>
>>
>>
>>
>>
>>   
> 
> 
> 
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you
> are not the intended recipient, you should not disseminate, distribute or
> copy this e-mail. Please notify the sender immediately and destroy all
> copies of this message and any attachments. 
> 
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus
> transmitted by this email.
>  
> www.wipro.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-File-Sender-Component%21-tf3714475s12049.html#a10392825
Sent from the ServiceMix - User mailing list archive at Nabble.com.


RE: Using File Sender Component!

Posted by ra...@wipro.com.
I think you can also use and XSLT SE to transform the XML to flat
structure. 


Regards,
Rabi Mishra, 
Wipro Technologies,Office: +91-20-39104549, VOIP:842
2545,CELL+91(0)9890363765  
http://rabisblog.blogspot.com/
-----Original Message-----
From: Gert Vanthienen [mailto:gert.vanthienen@skynet.be] 
Sent: Wednesday, May 09, 2007 4:50 PM
To: servicemix-users@geronimo.apache.org
Subject: Re: Using File Sender Component!

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
>
>
>
>
>
>
>   



The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
 
www.wipro.com

Re: Using File Sender Component!

Posted by bradtwurst <na...@xoxy.net>.
In the past, I've also used the BinaryFileMarshaler to deal with non-xml text
(comma-delimited text) coming/going to a file.

James



Gert Vanthienen wrote:
> 
> 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
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-File-Sender-Component%21-tf3714475s12049.html#a10614258
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Using File Sender Component!

Posted by Gert Vanthienen <ge...@skynet.be>.
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
>
>
>
>
>
>
>