I took a look at the XMLBeans data binding implementation for Axis2, and
have got some questions about this. For one thing, it looks like the
toOM() methods actually build the OM representation of the databound
objects, while I thought the idea behind Axis2 was to keep the OM
virtual unless absolutely necessary (for something like signing).
Also, the way in which Axis gets the data out of the databound objects
is by using an XMLStreamReader. AFAIK, XMLBeans is the only framework
which directly supports using a reader to get the XML representation of
the objects. Most frameworks (including JiBX and JAXB 2.0) only support
push-style output, where you tell the framework to serialize the XML
representation to some form of output interface and it does so before
returning. We could write an adapter to basically store the output from
one of these frameworks and make it readable using an XMLStreamReader,
but it would probably have a substantial impact on performance.
For other data binding frameworks it's probably best to define a special
type of OMElement to hold on to the object and the corresponding
serializer until the serialize() method of the OMElement is called, then
serialize directly to the supplied target. If we need to instead create
a full OM representation, we can use a builder that implements the
XMLStreamWriter interface and supply this to the binding framework as
the target for the marshalling output. This does make for an
all-or-nothing expansion, but this is probably the best we can do with
most data binding frameworks.
There's also the issue of how to link data binding to the MTOM support,
so that a data binding framework can pass off components to be
marshalled as attachments (and likewise access attachments for
unmarshalling). I don't know if XMLBeans has any support for this yet,
but JAXB 2.0 has it and I'll be adding it into JiBX.
- Dennis
- [Axis2] Databinding API issues Dennis Sosnoski
-