[servicemix-user] Files binding: processing non-XML files

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[servicemix-user] Files binding: processing non-XML files

eloudsa
Hi,

I would like to use servicemix to poll an input directory that may
contain XML and non-XML files.

In a first stage, these files have to be dropped into an output
directory without any specific processing.

Based on samples, it seems that File and VFS bindings expect to have a
XML's input file.

I saw that "Shishir K. Singh" has already posted a similar request
(Binary Files: How to ?).

Is there any way to process non-XML file?


Thanks,
Saïd



Reply | Threaded
Open this post in threaded view
|

Re: [servicemix-user] Files binding: processing non-XML files

John L. Simpson
I second Saïd'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 Saïd'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 Saïd 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.
Reply | Threaded
Open this post in threaded view
|

RE: Files binding: processing non-XML files

HURST, John B
In reply to this post by eloudsa
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:[hidden email]]
Sent: Saturday, 3 December 2005 15:45
To: [hidden email]
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 | Threaded
Open this post in threaded view
|

Re: Files binding: processing non-XML files

eloudsa
Hi John,

Thanks for your post.

Of course, we will be very interested to have a look on your component.

In our position, we would like to build an SOA/ESB infrastructure with
OpenSource software and for this reason why we are evaluating Mule and
ServiceMix solutions.

Of course, ServiceMix appears very nice but we estimate that examples
providing in the web site are not very dedicated to ServiceMix's newbies.

Regards,

Said



On Sunday 04 December 2005 22:06, HURST, John B wrote:

> 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:[hidden email]]
> Sent: Saturday, 3 December 2005 15:45
> To: [hidden email]
> 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
> ______________________________________________________________________

--
"---------------------------------------------------
Said ELOUDRHIRI
IT Solutions Manager
mailto:[hidden email]
Tel: +32 (0)10 68 64 12
GSM: +32 (0)477 51 40 57
Fax: +32 (0)10 68 63 63
Skype: eloudsa
Vivansa
Simply because you need results.
http://www.vivansa.com/
"---------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

RE: Files binding: processing non-XML files

HURST, John B
In reply to this post by eloudsa
Hi,

I attach ZipComponent.java as an example.

Note: I am NOT an expert on message flows in ServiceMix, so it's very
possible I've messed something up in my interpretation of how to set up
message exchanges.  I've only tested this code with straight-through
flow at this stage.  But it works for me!

In addition to reading the examples on the web site and in the code
distribution, I would encourage you to study the code for some of the
components themselves.  It is not particularly hard to write components,
and the provided ones give you some great starting points.

John Hurst
Wellington, New Zealand

-----Original Message-----
From: Said Eloudrhiri [mailto:[hidden email]]
Sent: Monday, 5 December 2005 11:40
To: [hidden email]
Subject: Re: [servicemix-user] Files binding: processing non-XML files

Hi John,

Thanks for your post.

Of course, we will be very interested to have a look on your component.

In our position, we would like to build an SOA/ESB infrastructure with
OpenSource software and for this reason why we are evaluating Mule and
ServiceMix solutions.

Of course, ServiceMix appears very nice but we estimate that examples
providing in the web site are not very dedicated to ServiceMix's
newbies.

Regards,

Said


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

RE: Files binding: processing non-XML files

HURST, John B
In reply to this post by eloudsa
Hi,

Whoops, my file attachment didn't work.

Here's the class, inline in this message:

public class ZipComponent extends OutBinding {

  private static final Log log = LogFactory.getLog(ZipComponent.class);

  private FileMarshaler marshaler = new DefaultFileMarshaler();

  public FileMarshaler getMarshaler() {
    return marshaler;
  }

  public void setMarshaler(FileMarshaler marshaler) {
    this.marshaler = marshaler;
  }

  protected void process(MessageExchange messageExchange,
NormalizedMessage message) throws MessagingException {
    try {
      String filename = getMarshaler().getOutputName(messageExchange,
message);
      if (log.isDebugEnabled()) {
        log.debug("ZIP processing file [" + filename + "]");
      }
      StreamSource source = (StreamSource) message.getContent();
      StreamSourceInputSource inputSource = new
StreamSourceInputSource(source);
      if (isZipFilename(filename)) {
        handleZipStream(inputSource);
      }
      else {
        sendFile(inputSource.getInputStream(), filename);
      }
      done(messageExchange);
    }
    catch (Exception ex) {
      throw new MessagingException(ex);
    }
  }

  private void handleZipStream(InputStreamSource inputStreamSource) {
    new ZipInputStreamTemplate(inputStreamSource).execute(new
ZipInputStreamCallback() {
      public Object doWithZipEntry(ZipInputStream zipInputStream,
ZipEntry zipEntry) throws Exception {
        if (isZipFilename(zipEntry.getName())) {
          handleZipStream(new
InputStreamInputStreamSource(zipInputStream));
        }
        else {
          if (log.isDebugEnabled()) {
            log.debug("ZIP sending file [" + zipEntry.getName());
          }
          sendFile(zipInputStream, zipEntry.getName());
        }
        return null;
      }
    });
  }

  private void sendFile(InputStream inputStream, String name) throws
IOException, JBIException {
    InOnly exchange = getExchangeFactory().createInOnlyExchange();
    NormalizedMessage message = exchange.createMessage();
    exchange.setInMessage(message);
    getMarshaler().readMessage(exchange, message, new
NonClosingInputStream(inputStream), name);
    getDeliveryChannel().sendSync(exchange);
  }

  private boolean isZipFilename(String filename) {
    return filename.toLowerCase().endsWith(".zip");
  }

}


John Hurst
Wellington, New Zealand

-----Original Message-----
From: HURST, John B [mailto:[hidden email]]
Sent: Monday, 5 December 2005 12:35
To: [hidden email]
Subject: RE: [servicemix-user] Files binding: processing non-XML files

Hi,

I attach ZipComponent.java as an example.

Note: I am NOT an expert on message flows in ServiceMix, so it's very
possible I've messed something up in my interpretation of how to set up
message exchanges.  I've only tested this code with straight-through
flow at this stage.  But it works for me!

In addition to reading the examples on the web site and in the code
distribution, I would encourage you to study the code for some of the
components themselves.  It is not particularly hard to write components,
and the provided ones give you some great starting points.

John Hurst
Wellington, New Zealand

-----Original Message-----
From: Said Eloudrhiri [mailto:[hidden email]]
Sent: Monday, 5 December 2005 11:40
To: [hidden email]
Subject: Re: [servicemix-user] Files binding: processing non-XML files

Hi John,

Thanks for your post.

Of course, we will be very interested to have a look on your component.

In our position, we would like to build an SOA/ESB infrastructure with
OpenSource software and for this reason why we are evaluating Mule and
ServiceMix solutions.

Of course, ServiceMix appears very nice but we estimate that examples
providing in the web site are not very dedicated to ServiceMix's
newbies.

Regards,

Said


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

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Files binding: processing non-XML files

eloudsa
Thanks John !



On Monday 05 December 2005 00:46, HURST, John B wrote:

> Hi,
>
> Whoops, my file attachment didn't work.
>
> Here's the class, inline in this message:
>
> public class ZipComponent extends OutBinding {
>
>   private static final Log log = LogFactory.getLog(ZipComponent.class);
>
>   private FileMarshaler marshaler = new DefaultFileMarshaler();
>
>   public FileMarshaler getMarshaler() {
>     return marshaler;
>   }
>
>   public void setMarshaler(FileMarshaler marshaler) {
>     this.marshaler = marshaler;
>   }
>
>   protected void process(MessageExchange messageExchange,
> NormalizedMessage message) throws MessagingException {
>     try {
>       String filename = getMarshaler().getOutputName(messageExchange,
> message);
>       if (log.isDebugEnabled()) {
>         log.debug("ZIP processing file [" + filename + "]");
>       }
>       StreamSource source = (StreamSource) message.getContent();
>       StreamSourceInputSource inputSource = new
> StreamSourceInputSource(source);
>       if (isZipFilename(filename)) {
>         handleZipStream(inputSource);
>       }
>       else {
>         sendFile(inputSource.getInputStream(), filename);
>       }
>       done(messageExchange);
>     }
>     catch (Exception ex) {
>       throw new MessagingException(ex);
>     }
>   }
>
>   private void handleZipStream(InputStreamSource inputStreamSource) {
>     new ZipInputStreamTemplate(inputStreamSource).execute(new
> ZipInputStreamCallback() {
>       public Object doWithZipEntry(ZipInputStream zipInputStream,
> ZipEntry zipEntry) throws Exception {
>         if (isZipFilename(zipEntry.getName())) {
>           handleZipStream(new
> InputStreamInputStreamSource(zipInputStream));
>         }
>         else {
>           if (log.isDebugEnabled()) {
>             log.debug("ZIP sending file [" + zipEntry.getName());
>           }
>           sendFile(zipInputStream, zipEntry.getName());
>         }
>         return null;
>       }
>     });
>   }
>
>   private void sendFile(InputStream inputStream, String name) throws
> IOException, JBIException {
>     InOnly exchange = getExchangeFactory().createInOnlyExchange();
>     NormalizedMessage message = exchange.createMessage();
>     exchange.setInMessage(message);
>     getMarshaler().readMessage(exchange, message, new
> NonClosingInputStream(inputStream), name);
>     getDeliveryChannel().sendSync(exchange);
>   }
>
>   private boolean isZipFilename(String filename) {
>     return filename.toLowerCase().endsWith(".zip");
>   }
>
> }
>
>
> John Hurst
> Wellington, New Zealand
>
> -----Original Message-----
> From: HURST, John B [mailto:[hidden email]]
> Sent: Monday, 5 December 2005 12:35
> To: [hidden email]
> Subject: RE: [servicemix-user] Files binding: processing non-XML files
>
> Hi,
>
> I attach ZipComponent.java as an example.
>
> Note: I am NOT an expert on message flows in ServiceMix, so it's very
> possible I've messed something up in my interpretation of how to set up
> message exchanges.  I've only tested this code with straight-through
> flow at this stage.  But it works for me!
>
> In addition to reading the examples on the web site and in the code
> distribution, I would encourage you to study the code for some of the
> components themselves.  It is not particularly hard to write components,
> and the provided ones give you some great starting points.
>
> John Hurst
> Wellington, New Zealand
>
> -----Original Message-----
> From: Said Eloudrhiri [mailto:[hidden email]]
> Sent: Monday, 5 December 2005 11:40
> To: [hidden email]
> Subject: Re: [servicemix-user] Files binding: processing non-XML files
>
> Hi John,
>
> Thanks for your post.
>
> Of course, we will be very interested to have a look on your component.
>
> In our position, we would like to build an SOA/ESB infrastructure with
> OpenSource software and for this reason why we are evaluating Mule and
> ServiceMix solutions.
>
> Of course, ServiceMix appears very nice but we estimate that examples
> providing in the web site are not very dedicated to ServiceMix's
> newbies.
>
> Regards,
>
> Said
>
>
> ______________________________________________________________________
> 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
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________

--
"---------------------------------------------------
Said ELOUDRHIRI
IT Solutions Manager
mailto:[hidden email]
Tel: +32 (0)10 68 64 12
GSM: +32 (0)477 51 40 57
Fax: +32 (0)10 68 63 63
Skype: eloudsa
Vivansa
Simply because you need results.
http://www.vivansa.com/
"---------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

RE: Files binding: processing non-XML files

Neal Tovsen
In reply to this post by eloudsa
 
+1 on the non-XML file processing.

My real-world experience has also been that legacy systems only capable
of flat-file processing is the bleak reality of many enterprises. Not
only that, but often you have to poll or write files to the filesystem.
It isn't ideal, but it is necessary.

I am also trying to evaluate ServiceMix as an ESB solution. So far, I
like the idea of a normalized message bus quite a lot vs. the
anything-goes nature of Mule (which so far, among other things, seems to
make it very non-intuitive to use). But you have to have some sort of
inbound tranlator to normalize non-XML files so they can flow on the
bus. To simply wrap any random big string of text in <file></file> and
call it "normalized" is not very useful and IMHO undermines the whole
philosophy.

Perhaps a configurable/declarative mechanism for working with text files
is in order. Ideally, it would handle files that may have either
character-delimited or fixed-width fields, and may not necessarily be
broken down into a simple one-line-per-record scenario (i.e. may have a
header line, footer line, or perhaps even where more than one line
equates to a record).

I wouldn't mind seeing if I could come up with some sort of Flat-File
extension to the FilePoller or something similar, but I am also having
some trouble getting things outside the provided examples to work
(hopefully/probably just newbie errors). So I guss I can only offer my
meek little "me too" for now...

Neal


________________________________

From: John L. Simpson (sent by Nabble.com) [mailto:[hidden email]]
Sent: Friday, December 02, 2005 8:45 PM
To: [hidden email]
Subject: Re: [servicemix-user] Files binding: processing non-XML files


I second Sad's query.

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).
Reply | Threaded
Open this post in threaded view
|

RE: Files binding: processing non-XML files

George Gastaldi
In reply to this post by eloudsa
+1 Agreed,
        However, I am still using BytesSource/StringSource/StreamSource for non-XML files and no errors occurred yet. Of course, I translate the EDI/Flat file to XML before using XSL or another type of router.

George

-----Original Message-----
From: Neal Tovsen [mailto:[hidden email]]
Sent: Monday, December 05, 2005 5:55 PM
To: [hidden email]
Subject: RE: [servicemix-user] Files binding: processing non-XML files


 
+1 on the non-XML file processing.

My real-world experience has also been that legacy systems only capable
of flat-file processing is the bleak reality of many enterprises. Not
only that, but often you have to poll or write files to the filesystem.
It isn't ideal, but it is necessary.

I am also trying to evaluate ServiceMix as an ESB solution. So far, I
like the idea of a normalized message bus quite a lot vs. the
anything-goes nature of Mule (which so far, among other things, seems to
make it very non-intuitive to use). But you have to have some sort of
inbound tranlator to normalize non-XML files so they can flow on the
bus. To simply wrap any random big string of text in <file></file> and
call it "normalized" is not very useful and IMHO undermines the whole
philosophy.

Perhaps a configurable/declarative mechanism for working with text files
is in order. Ideally, it would handle files that may have either
character-delimited or fixed-width fields, and may not necessarily be
broken down into a simple one-line-per-record scenario (i.e. may have a
header line, footer line, or perhaps even where more than one line
equates to a record).

I wouldn't mind seeing if I could come up with some sort of Flat-File
extension to the FilePoller or something similar, but I am also having
some trouble getting things outside the provided examples to work
(hopefully/probably just newbie errors). So I guss I can only offer my
meek little "me too" for now...

Neal


________________________________

From: John L. Simpson (sent by Nabble.com) [mailto:[hidden email]]
Sent: Friday, December 02, 2005 8:45 PM
To: [hidden email]
Subject: Re: [servicemix-user] Files binding: processing non-XML files


I second Sad's query.

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).
Reply | Threaded
Open this post in threaded view
|

RE: Files binding: processing non-XML files

HURST, John B
In reply to this post by eloudsa
Hi,

I've had reasonable success dealing with non-XML files in the regular
service pipeline, i.e. as an OutBinding, because I can simply cast the
message content as a StreamSource and get a binary input stream from
that.

I tried to use the subscription mechanism to route some non-XML
messages, and it didn't work so well.  The SubscriptionManager uses by
default a CopyTransformer to get a copy of the message, to send to a
subscriber.  The problem is the CopyTransformer attempts to parse the
stream so as to get a DOMSource -- no good if the stream isn't XML.

Are we fighting uphill to process non-XML with ServiceMix?  Or, can I
specify the MessageTransformer to be used by the SubscriptionManager?  I
could probably code up an enhanced MessageTransformer that is tolerant
of specific binary formats in my usage.

John Hurst
Wellington, New Zealand



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Files binding: processing non-XML files

Guillaume Nodet
Administrator
Hi John,

I really think your way of handling non-xml content is not the easier
one, as you will certainly
face lots of problems, trying to get around the fact the the content of
the message has to be
an xml stream.

A better way should be to use attachments on the NormalizedMessage, as these
should also be able to handle non-xml data in a much better way.  Do you
any drawbacks
in trying this ?

Guillaume

HURST, John B wrote:

>Hi,
>
>I've had reasonable success dealing with non-XML files in the regular
>service pipeline, i.e. as an OutBinding, because I can simply cast the
>message content as a StreamSource and get a binary input stream from
>that.
>
>I tried to use the subscription mechanism to route some non-XML
>messages, and it didn't work so well.  The SubscriptionManager uses by
>default a CopyTransformer to get a copy of the message, to send to a
>subscriber.  The problem is the CopyTransformer attempts to parse the
>stream so as to get a DOMSource -- no good if the stream isn't XML.
>
>Are we fighting uphill to process non-XML with ServiceMix?  Or, can I
>specify the MessageTransformer to be used by the SubscriptionManager?  I
>could probably code up an enhanced MessageTransformer that is tolerant
>of specific binary formats in my usage.
>
>John Hurst
>Wellington, New Zealand
>
>
>
>______________________________________________________________________
>This email has been scanned by the MessageLabs Email Security System.
>For more information please visit http://www.messagelabs.com/email 
>______________________________________________________________________
>
>
>  
>

Reply | Threaded
Open this post in threaded view
|

RE: Files binding: processing non-XML files

John Hurst-6
Hi Guillaume,

Thanks very much for your comments.  I had not considered the use of
attachments -- it is definitely worth considering.  I will try to rework my
current FTP/unzipping process to use attachments.

Funnily enough I was just at the point of trying to run Mule instead because
of this issue.  But I haven't got up to speed with Mule yet, and I am
fitting this work in between maintenance and other development work.

I think I noticed you are/were a Mule developer also?  You are a busy
fellow!

Regards

John Hurst
Wellington, New Zealand

> -----Original Message-----
> From: Guillaume Nodet [mailto:[hidden email]]
> Sent: Saturday, 10 December 2005 12:07
> To: [hidden email]
> Subject: Re: [servicemix-user] Files binding: processing non-XML files
>
> Hi John,
>
> I really think your way of handling non-xml content is not the easier
> one, as you will certainly
> face lots of problems, trying to get around the fact the the content of
> the message has to be
> an xml stream.
>
> A better way should be to use attachments on the NormalizedMessage, as
> these
> should also be able to handle non-xml data in a much better way.  Do you
> any drawbacks
> in trying this ?
>
> Guillaume
>
> HURST, John B wrote:
>
> >Hi,
> >
> >I've had reasonable success dealing with non-XML files in the regular
> >service pipeline, i.e. as an OutBinding, because I can simply cast the
> >message content as a StreamSource and get a binary input stream from
> >that.
> >
> >I tried to use the subscription mechanism to route some non-XML
> >messages, and it didn't work so well.  The SubscriptionManager uses by
> >default a CopyTransformer to get a copy of the message, to send to a
> >subscriber.  The problem is the CopyTransformer attempts to parse the
> >stream so as to get a DOMSource -- no good if the stream isn't XML.
> >
> >Are we fighting uphill to process non-XML with ServiceMix?  Or, can I
> >specify the MessageTransformer to be used by the SubscriptionManager?  I
> >could probably code up an enhanced MessageTransformer that is tolerant
> >of specific binary formats in my usage.
> >
> >John Hurst
> >Wellington, New Zealand
> >
> >
> >
> >______________________________________________________________________
> >This email has been scanned by the MessageLabs Email Security System.
> >For more information please visit http://www.messagelabs.com/email
> >______________________________________________________________________
> >
> >
> >
> >