Hi All,

     I'm using MTOM support in Axis2 to support the upload of one or more
attachments per web service request, and have cacheAttachments=true in
axis2.xml so that uploaded MIME attachments are spooled to disk to prevent
OutOfMemoryErrors.  This works great as long as the attachments are passed
as separate MIME parts, but MTOM also allows for the attachments to be
passed as inline Base64 strings.  If a client passes a really large
attachment/attachments as inline Base64, it will still bypass the file
attachment caching and consume large amounts of memory.  I don't have
control of the implementation of the clients, so I'm trying to protect the
server from these large binary strings.
    Right now what I am doing is limiting the HTTP post size coming into
the app server, but that means that I have to limit the size of MTOM
uploads based on available JVM memory rather than based on available file
system space for attachments.  I'd prefer to do it based on disk space if
possible (# of concurrent requests * max post size <= file system space
allocated for storing attachments).

    What I would ideally like to do is have the inline base64 strings go
through the same file caching mechanism that MIME parts do, so that I can
prevent OutOfMemoryErrors and be generous with the allowed attachment sizes
regardless of whether the attachments are optimized or not.  If that is not
possible, I'd like to at least set a server side limit on the size of
base64 strings that Axis2 will accept, so that I can set a more generous
limit for HTTP posts that do use separate mime parts for attachments, and
put the tighter restrictions only on base64 strings.

I've been working with Axis2 1.6.1 (with both the included version of
Woodstox and 4.1.2), and haven't yet figured out a way to accomplish either
one of the goals above. So my first question is: Is this something that can
be done with the current versions of Axis2, Axiom, Woodstox (or some other
Stax parser if that would work better)?  Or is there a better way to
protect the server?

If it is possible to either limit the size of base64 strings coming in or
get the base64 strings to use the file caching, can anyone recommend an
approach or point me to an area to look in to get started?
My WSDL defines the attachments as xmime:base64Binary and I am currently
using ADB data binding (though I can change to a different binding
mechanism or switch to calling Axiom directly if that would help.) I'm not
sure what other information is needed but can post more details if that
would be helpful.

Thanks!

Reply via email to