You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Timothy High <ti...@sknt.com> on 2006/07/23 17:24:41 UTC
Question about binary data
Hello all,
I am trying to decide between using Mule and ServiceMix for my integration platform. While the JBI architecture seems interesting and flexible at a high level, there seems to be an inherent limitation in requiring XML documents for all NormalizedMessage content. I have tried the file-binding example, for example, and it only works with valid XML files. This seems pretty limited, considering that many "integration" projects really only require something that simple. While JBI is focused on providing interchangeable service implementations (for which using standardized message formats is a must), I don't see why ServiceMix itself should limit itself to that restriction. Does ServiceMix provide an alternative for routing binary or non-XML messages to components?
I know that there are many possible workarounds for this: placing the data in a message property, wrapping the content in a simple XML document (<message><![CDATA[ my data ]]></message>), using message attachments, marshalling the data to some XML format, etc. None of these seem like a very easy or standard way to deal with this problem. What do you recommend?
Thanks,
Tim.
----------------------------------------------------------
Timothy High
Software Engineering
timothy.high@sknt.com <ma...@sknt.com>
Sakonnet Technology
Centro Empresarial Mourisco
Praia de Botafogo 501 1°Andar
Bloco A - Torre Pão de Açúcar
22250-040 - Rio de Janeiro, RJ Brazil
www.sknt.com <http://www.sknt.com/>
+55 (21) 2586 6102 direct
+55 (21) 2586 6001 fax
Re: Question about binary data
Posted by Guillaume Nodet <gn...@gmail.com>.
Some time ago, we were not allowed to redistribute those
jars. The 3.0.1 / 3.1 will include these jars instead of the
Geronimo ones.
On 10/31/06, jlo_gestalt <jl...@gestalt-llc.com> wrote:
>
> This might be a stupid question, but I have to know.
>
> Why doesn't ServiceMix just come with those jars in the first place?
> --
> View this message in context: http://www.nabble.com/Question-about-binary-data-tf1988217.html#a7094463
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet
Re: Question about binary data
Posted by jlo_gestalt <jl...@gestalt-llc.com>.
This might be a stupid question, but I have to know.
Why doesn't ServiceMix just come with those jars in the first place?
--
View this message in context: http://www.nabble.com/Question-about-binary-data-tf1988217.html#a7094463
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Question about binary data
Posted by Guillaume Nodet <gn...@gmail.com>.
I'm not sure that gzip streams are handled directly by activation.
So try using a DataSource instead.
DataSource ds = ...;
normalizedMessage.addAttachment("response", new DataHandler(ds));
On 10/31/06, jlo_gestalt <jl...@gestalt-llc.com> wrote:
>
> Still not working. I am lost as to what to do next.
>
> Here is what I did:
>
> Removed {SERVICEMIX_HOME/lib/geronimo-activation_1.0.2_spec-1.1.jar
> Removed {SERVICEMIX_HOME/lib/geronimo-javamail_1.3.1_spec-1.1.jar
> Downloaded activation-1.1.jar and copied it to {SERVICEMIX_HOME/lib/
> Downloaded mail-1.4.jar and copied it to {SERVICEMIX_HOME/lib/
>
>
> Here is how I am creating my DataHandler that I add as an attachment:
>
>
> normalizedMessage.addAttachment("response", new DataHandler(dataOut,
> "application/x-gzip"));
>
>
> The variable dataOut is a String containing gzipped binary data.
>
>
> Here is the stack trace:
>
>
> java.lang.Exception: javax.activation.UnsupportedDataTypeException: no
> object DCH for MIME type application/x-gzip
> at
> org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:202)
> at
> org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:443)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:356)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:615)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
> at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
> at org.mortbay.jetty.Server.handle(Server.java:269)
> at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:430)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:333)
> at
> org.mortbay.jetty.nio.HttpChannelEndPoint.run(HttpChannelEndPoint.java:270)
> at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
> Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for
> MIME type application/x-gzip
> at javax.activation.DataHandler.getInputStream(DataHandler.java:247)
> at
> javax.activation.DataHandlerDataSource.getInputStream(DataHandler.java:702)
> at javax.activation.DataHandler.writeTo(DataHandler.java:304)
> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)
> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:845)
> at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:361)
> at
> com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:85)
> at
> javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:883)
> at javax.activation.DataHandler.writeTo(DataHandler.java:316)
> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)
> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1683)
> at
> org.apache.servicemix.soap.marshalers.SoapWriter.writeMultipartMessage(SoapWriter.java:162)
> at
> org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:80)
> at
> org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:280)
> at
> org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:123)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:410)
> at
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:43)
> at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:624)
> at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:169)
> at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:177)
> at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:227)
> at
> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
> at
> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
> at java.lang.Thread.run(Thread.java:595)
>
> --
> View this message in context: http://www.nabble.com/Question-about-binary-data-tf1988217.html#a7097197
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet
Re: Question about binary data
Posted by jlo_gestalt <jl...@gestalt-llc.com>.
Still not working. I am lost as to what to do next.
Here is what I did:
Removed {SERVICEMIX_HOME/lib/geronimo-activation_1.0.2_spec-1.1.jar
Removed {SERVICEMIX_HOME/lib/geronimo-javamail_1.3.1_spec-1.1.jar
Downloaded activation-1.1.jar and copied it to {SERVICEMIX_HOME/lib/
Downloaded mail-1.4.jar and copied it to {SERVICEMIX_HOME/lib/
Here is how I am creating my DataHandler that I add as an attachment:
normalizedMessage.addAttachment("response", new DataHandler(dataOut,
"application/x-gzip"));
The variable dataOut is a String containing gzipped binary data.
Here is the stack trace:
java.lang.Exception: javax.activation.UnsupportedDataTypeException: no
object DCH for MIME type application/x-gzip
at
org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:202)
at
org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:443)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:356)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:615)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
at org.mortbay.jetty.Server.handle(Server.java:269)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:430)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:333)
at
org.mortbay.jetty.nio.HttpChannelEndPoint.run(HttpChannelEndPoint.java:270)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for
MIME type application/x-gzip
at javax.activation.DataHandler.getInputStream(DataHandler.java:247)
at
javax.activation.DataHandlerDataSource.getInputStream(DataHandler.java:702)
at javax.activation.DataHandler.writeTo(DataHandler.java:304)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:845)
at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:361)
at
com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:85)
at
javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:883)
at javax.activation.DataHandler.writeTo(DataHandler.java:316)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1683)
at
org.apache.servicemix.soap.marshalers.SoapWriter.writeMultipartMessage(SoapWriter.java:162)
at
org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:80)
at
org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:280)
at
org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:123)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:410)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:43)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:624)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:169)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:177)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:227)
at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Thread.java:595)
--
View this message in context: http://www.nabble.com/Question-about-binary-data-tf1988217.html#a7097197
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Question about binary data
Posted by Guillaume Nodet <gn...@gmail.com>.
You may want to try removing the geronimo implementation
of mail and activation and replace them with the sun jars
available at
http://repo.mergere.com/maven2/javax/mail/mail/1.4/mail-1.4.jar
http://repo.mergere.com/maven2/javax/activation/activation/1.1/activation-1.1.jar
On 10/30/06, jlo_gestalt <jl...@gestalt-llc.com> wrote:
>
> We are also having difficulty with binary XML.
> We have tried setting an attachment, but receive a
> javax.activation.UnsupportedDataTypeException.
>
> I was wanting to know how you successfully added binary data as an
> attachment? And what was the custom code you had to write? What the custom
> code something like this: http://javafaq.nu/java-example-code-333.html
> http://javafaq.nu/java-example-code-333.html
> I think we are specifically getting hung up on the mime type, which we have
> tried several including application/octet-stream.
>
> Any help would be appreciated.
> --
> View this message in context: http://www.nabble.com/Question-about-binary-data-tf1988217.html#a7084784
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet
Re: Question about binary data
Posted by jlo_gestalt <jl...@gestalt-llc.com>.
We are also having difficulty with binary XML.
We have tried setting an attachment, but receive a
javax.activation.UnsupportedDataTypeException.
I was wanting to know how you successfully added binary data as an
attachment? And what was the custom code you had to write? What the custom
code something like this: http://javafaq.nu/java-example-code-333.html
http://javafaq.nu/java-example-code-333.html
I think we are specifically getting hung up on the mime type, which we have
tried several including application/octet-stream.
Any help would be appreciated.
--
View this message in context: http://www.nabble.com/Question-about-binary-data-tf1988217.html#a7084784
Sent from the ServiceMix - User mailing list archive at Nabble.com.
RE: Question about binary data
Posted by mart <ma...@googlemail.com>.
I just solved the problem: the property ContentType was not set when using
the marshaller...
mart wrote:
>
> I use JBI attachment for binary data, see BinaryMarshaler . Problem is I
> have trouble when it comes to convert the JBI + JBI binary attachment to a
> email/http/jms message with MIME attachment i have:
>
> javax.mail.internet.ParseException
> at javax.mail.internet.ContentType.<init>(ContentType.java:83)
> at
> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1249
> )
> [...]
>
>
>
> Timothy High wrote:
>>
>> Hi,
>>
>> Thanks for your help! I guess we'll give it a shot, and see how it goes.
>> FYI, some of my coworkers have tried using Base64Encoded messaging
>> before, and warn me that there are a lot of pitfalls. If the ServiceMix
>> team (or anyone out there) decides to give it a shot, I'll hit them up
>> for more details!
>>
>> Thanks,
>> Tim.
>>
>>
>> -----Original Message-----
>> From: apinke [mailto:apinkelefant@gmail.com]
>> Sent: Monday, July 24, 2006 3:57 AM
>> To: servicemix-users@geronimo.apache.org
>> Subject: Re: Question about binary data
>>
>>
>> Hi Tim ,
>>
>> I came across similar issues while using ServiceMix and unfortunately ,
>> I
>> did not find an easy way to solve these problems. I ended up puting the
>> binary data as an attachment in the message , but custom code is
>> required at
>> both the ends to get the data and convert it into something meaningful..
>>
>> One idea is that SM can provide a Base64Encoded Message format ,
>> something
>> that skips the xml'izing altogether..
>>
>> Pat
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Question-about-binary-data-tf1988217.html#a5462590
>> Sent from the ServiceMix - User forum at Nabble.com.
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Question-about-binary-data-tf1988217.html#a7094972
Sent from the ServiceMix - User mailing list archive at Nabble.com.
RE: Question about binary data
Posted by mart <ma...@googlemail.com>.
I use JBI attachment for binary data, see BinaryMarshaler . Problem is I have
trouble when it comes to convert the JBI + JBI binary attachment to a
email/http/jms message with MIME attachment i have:
javax.mail.internet.ParseException
at javax.mail.internet.ContentType.<init>(ContentType.java:83)
at
javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1249
)
[...]
Timothy High wrote:
>
> Hi,
>
> Thanks for your help! I guess we'll give it a shot, and see how it goes.
> FYI, some of my coworkers have tried using Base64Encoded messaging
> before, and warn me that there are a lot of pitfalls. If the ServiceMix
> team (or anyone out there) decides to give it a shot, I'll hit them up
> for more details!
>
> Thanks,
> Tim.
>
>
> -----Original Message-----
> From: apinke [mailto:apinkelefant@gmail.com]
> Sent: Monday, July 24, 2006 3:57 AM
> To: servicemix-users@geronimo.apache.org
> Subject: Re: Question about binary data
>
>
> Hi Tim ,
>
> I came across similar issues while using ServiceMix and unfortunately ,
> I
> did not find an easy way to solve these problems. I ended up puting the
> binary data as an attachment in the message , but custom code is
> required at
> both the ends to get the data and convert it into something meaningful..
>
> One idea is that SM can provide a Base64Encoded Message format ,
> something
> that skips the xml'izing altogether..
>
> Pat
>
> --
> View this message in context:
> http://www.nabble.com/Question-about-binary-data-tf1988217.html#a5462590
> Sent from the ServiceMix - User forum at Nabble.com.
>
>
>
--
View this message in context: http://www.nabble.com/Question-about-binary-data-tf1988217.html#a7092060
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Question about binary data
Posted by apinke <ap...@gmail.com>.
Hi Tim ,
I came across similar issues while using ServiceMix and unfortunately , I
did not find an easy way to solve these problems. I ended up puting the
binary data as an attachment in the message , but custom code is required at
both the ends to get the data and convert it into something meaningful..
One idea is that SM can provide a Base64Encoded Message format , something
that skips the xml'izing altogether..
Pat
--
View this message in context: http://www.nabble.com/Question-about-binary-data-tf1988217.html#a5462590
Sent from the ServiceMix - User forum at Nabble.com.