axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Jellinghaus <>
Subject Re: How do you know you've got attachments?
Date Sat, 27 Oct 2001 21:04:41 GMT
In the general case, you might not be passing a raw DataHandler into the call object; you might
pass an array of them, or a struct containing them, or an array of structs containing them.
 The same is true on the server side where you could return any serializable object (say,
a whole tree of beans of some kind, some of which have DataHandler members).

In general, you don't know whether there are any DataHandlers hiding down inside the values
being passed, until you serialize.


At 08:08 AM 10/27/2001 -0400, Doug Davis wrote:
>I'm missing something - if someone passes in a DataHandler
>to the Call object, and it is going to be made into an attachment
>then why do you need to search or buffer anything- you know there's
>an attachment right away (based on the type of the argument, its
>a DataHandler) just set a flag and then when you serialize you know
>know you need MIME - no buffering needed. What am I missing?
>Rob Jellinghaus <> on 10/26/2001 08:51:36 PM
>Please respond to
>Subject:  How do you know you've got attachments?
>(I'm sending these various attachment design issues to the list, partly
>because I genuinely do want input, and partly because some folks here have
>in the past requested more visibility into ongoing design topics.)
>When sending an outbound message, how should Axis determine whether to use
>a MIME enclosure or not?
>The simple answer is "if there are any attachments, send a MIME envelope.
>However, one common scenario for using attachments will be that users
>simply pass a DataHandler as an argument to a Call object.  (Apache SOAP
>supports this -- just pass a DataHandler as argument, and it will be
>serialized as an attachment, and deserialized as a DataHandler on the other
>So if the user passes a DataHandler as an argument, rather than explicitly
>calling any addBodyPart-like API, then when does Axis recognize that there
>are now attachments in the Message?
>There are two alternatives:
>- When SOAPBodyElements are added to a SOAPEnvelope, they could be checked
>to see if they contain DataHandlers.
>     Pro: this is done before any serialization, so you can know upfront
>you need to create a MIME envelope.
>     Con: this would be complex and there isn't any precedent for it.
>- When an envelope is serialized, any DataHandlers encountered could be
>converted into attachments.
>     Pro: this leverages the serialization framework, and lets it do its
>     Con: you have to serialize the whole envelope before you start sending
>any MIME content, since it is envelope serialization that tells you what
>attachments you must send.
>Apache SOAP takes the second strategy... actually, even worse:  it
>serializes, not only the envelope, but also all the attachments!  It
>buffers them all in memory and then sends the whole buffer.  This means
>that Apache SOAP's memory overhead is something like 2x the size of the
>attachments themselves.
>I plan to pursue the second strategy:  serialize the envelope (only!) into
>a buffer before sending.  This means that we will not support streaming out
>very huge envelopes, but I think that's OK -- we're prioritizing support
>for huge attachments, not huge envelopes.
>Thoughts?  Lack of response will be interpreted as assent :-)

View raw message