Hi,

We had to process binary content in the form of ZIP files into
ServiceMix.  I created a ZipComponent to do this.  I could post code if
you really want it, although currently it is written to use one or two
local utility classes for handling ZIP streams, so it might be a bit
obscure.

Basically I extended OutBinding (as does FileWriter).  In process() I
cast the message content as a StreamSource, and do my business.  I am
creating XML content in the message that I forward downstream.  (In my
case, the ZIP file contains XML files.)

I'm not an expert, and this approach may have mistakes, but it seems to
be working for me.

Regards

John Hurst
Wellington, New Zealand
________________________________________
From: John L. Simpson (sent by Nabble.com) [mailto:[EMAIL PROTECTED] 
Sent: Saturday, 3 December 2005 15:45
To: [email protected]
Subject: Re: [servicemix-user] Files binding: processing non-XML files

I second Sad's query. 

I've just switched from using Mule, because no-one on that project's
forum could explain how to meet another common requirement
(specifically, how to set message properties based on the value of my
XML content). In ServiceMix, however, I haven't even got that far - I'm
stuck at the very start of the process chain. 

In Mule, I was able to easily convert non-XML input files into XML
content by using that framework's ObjectToXml transformer on the input
file's endpoint. But it seems that ServiceMix simply does not allow
non-XML data as file input. (The source code supports Sad's conclusion).


I am fully for JBI and the concept of a normalized message. However, in
the real world, we are faced with applications which spit out non-XML
data. And I'm not talking about awkward binary files - just plain-text
ASCII files which lack XML markup and perhaps contain some illegal
characters. (In my case, the files contain a few control characters like
x00 and x03). 

I want to take those files, strip out the invalid characters (easily
done in Groovy), transform the rest of it into XML and then do something
useful with it. But, before I can achieve any of that, I need to get the
data onto the bus in the first place. 

Yes, I could write a small preprocessor to wrap the plain text inside
XML tags before injecting the data into ServiceMix. But then I lose all
the benefits of the ServiceMix framework, including transaction support.


Alternatively, I might even be able to write a custom ServiceMix
component to do the job. But I'm new to ServiceMix, and I'd feel a lot
safer using a standard component, if only someone could please explain
how! 

I cannot believe that Sad and I are the only two people who have non-XML
input - surely this is a common circumstance? Are we missing something
in our understanding? 

Thanks, John. 
________________________________________
Sent from the servicemix - user forum at Nabble.com:
Re: [servicemix-user] Files binding: processing non-XML files 
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Reply via email to