On 23 Aug 2005, at 02:12, Josh Reed wrote:
Hello,
I was looking at re-implementing a framework that I had previously
written to a more SOA-type of system. I spent most of last week
breaking the existing codebase down into distinct services and
planning new services I'd need (caching, jabber, dbcp, etc.).
Fortunately for me, I saw the ServiceMix announcement on TSS last
night. It looks like a great system; very similar to what I was
planning on implementing myself but further along and more standards
compliant.
Great! :) Welcome!
My one last concern is if it is possible to do binary
payloads/content.
The quick 2 answers are...
In JBI a NormalizedMessage can have Attachments which can be anything
binary (PDFs, spreadsheets, images, any-old-binary-stuff etc). Also a
NormalizedMessage can have a number of properties attached which are
logically like SOAP headers; so you could put any POJO or byte[] or
whatever in a header if need be.
http://servicemix.codehaus.org/maven/apidocs/javax/jbi/messaging/
NormalizedMessage.html#addAttachment(java.lang.String,%
20javax.activation.DataHandler)
Here is the standard process flow: a request would come in via SOAP or
REST. The request would be resolved, validated, executed, and then
would be serialized to a specific format based on a request parameter.
So the request might involve executing a database query then
serializing it out as an Excel spreadsheet or creating a chart via
JFreeChart and then sending it back to the user. How does this
serialization work with ServiceMix? Can I have a service that just
generates an array of bytes as the message contents and then my
servlet just grabs the contents and dumps it out to the response? Or
is there some more elegant way of doing things?
Probably the easiest way would be to add a named attachment to the
NormalizedMessage then a Servlet could use MIME encoding to output it
to a REST HTTP client. Currently the HttpInOutBinding does not use
MIME encoding of NormalizedMessage with attachments - we should add
that...
http://jira.logicblaze.com/jira/browse/SM-44
In the previous version of my framework, my message class just
contained an OutputStream that the serialization service could write
out to (I did this so I didn't have to send back 10MB+ objects).
However, in the end I think the servlet was just passing in a
ByteArrayOutputStream so I was keeping the 10MB+ of data in memory
anyways :)
:)
Using the DataHandler from the javax.activation package you should be
able to achieve a similar thing
James
-------
http://radio.weblogs.com/0112098/