You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Ajith Ranabahu <aj...@gmail.com> on 2006/04/05 06:55:18 UTC

[Axis2] Better support for MTOM in Axis2

Hi all,
Thanks to Dennis, we seriously thought of having better MTOM support
in Axis2 and this is what we came up with. However I'll give a brief
overview of the problem for the benefit of the folks who are not
familiar with the earlier discussions.
When an OM tree is considered, the OM tree has no notion of providing
meta information such as the internal content of a text node. For
example by looking at the OM tree, we cannot determine whether a given
text node contains Base64Encoded binary content or just string data.
This is particularly a disadvantage in the case of MTOMized binary
content since databinding tools are unable to provide the information
that certain content can be optimized. We do have a notion of marking
certain OMElements as optimized but such information never passes
between the data binding world (ADB/XMLBeans/JibX) and the Axis2 world
since the primary means of linking these two worlds is through the
StAX reader interface. Right now what basically happens is that the
binary gets converted into Base64 encoded text, passed throught the
StAX interface to the "other" world (which can be either the Axis2/OM
world or the ADB/XMLBeans/JibX world) and then decoded at the time of
writing or storing. Needless to say the capabilities of OM to handle
binary content is ignored and there is a memory and performance cost
in doing all the conversions.
OK now the proposed solution. Note that this is the solution we
thought of for the ADB case since that is what we have access to.
Other databinding frameworks may use a similar technique to get the
Axis2 support for MTOM supported databinding. (and this seems to be
the minimal-change path also)

* StAX reader interface (XMLStreamReader) has a getProperty method
which returns an Object. The interface contract does not bind the use
of it to anything specific so we are free to use it for our own needs
:)
* Inorder to make this thing work the ADB pullparser (BTW now known as
the ADBXMLStreamReader) provides a property for the key  "are you
binary?" which is either true or false, when the parser is at a
CHARACTERS state.
* if "are you binary?" returns true then the parser also provides a
Datahandler object for the key "data handler". This data handler can
be used to access the binary data.
So the information whether a particular CHARACTERS event is really
related to binary can be effectively passed through the StAX reader
interface. The pullparser user should know how to handle the extra
information provided through the parser. The "pull parser user"
mentioned here can either be the sender (who may need to write a MIME
part for the binary content) or the StAXOMBuilder (who needs to
construvt an OM tree with proper "optimize" flags). In order for the
pull parser user to know when to do this, it may need schema
information.

This seems to be a viable solution with minimal change to the code base

Thoughts ?

Ajith