You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Daniel Kulp <dk...@apache.org> on 2008/02/01 04:27:02 UTC

Re: data binding question

Rob,

Writing a new databinding is slightly tricky to get completely working 
correctly.   I don't think we have any good docs for it yet.   The new 
xmlbeans databinding (on trunk only) is probably the easiest to follow 
as an example as it doesn't do anything that complex yet.

The steps to creating a databinding would be:

1) Write Reader/Writer implementations that read/write to 
XmlStreamReader/Writers.     In some cases, the runtime also wants 
readers/writers for nodes, but you can always create a 
XmlStreamReader/Writer  from the node and feed it into the same impl.   
JAXB does does some optimizations if it's a node, but for simplicity, 
the xmlbeans databinding currently doesn't.

2) Write the "DataBinding" object that creates the readers/writers.   
The tricky part of this is the initizialize(...) method.  It needs to 
create the schemas and get them plugged into the service model for all 
the parts so that the generated wsdl will look correct.    For XMLBeans, 
it was pretty simple as the schemas are in the generated jar.   For 
each "MessagePartInfo" just need to find the appropriate XmlSchema 
element or type and set the appropriate fields.

3) Fault handling - this is somewhat optional (xmlbeans doesn't do it 
yet), but if your databinding has special rules for handling/mapping 
exceptions, both of the above would need updating for that as well.  A 
chunk of jaxb's complexity is around that.

Anyway, I'd definitely recommend looking at the XmlBeans databinding.   
The JAXB databinding does a BUNCH of things that makes it very complex.   

Dan


On Wednesday 30 January 2008, Rob Barrett wrote:
> I'm about to start some data binding code to map soap messages to java
> components and I'm looking at the DataBinding interfaces in cxf.
>
> Could anyone point me at a good point of introduction to this
> interface/class set. I'd like to find out about the lifecycle of these
> things, how/when they are called, etc.
>
> Thanks, Rob



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: data binding question

Posted by Daniel Kulp <dk...@apache.org>.
On Friday 01 February 2008, Rob Barrett wrote:
> Thanks for that Daniel.
>
> Do you know if there's a consistent sequence that cxf forces the
> binders and invokers to follow i.e. Reader -> Invoker -> Writer  or if
> there are scenarios that should cause the sequnce to change?

The #1 scenario that will cause that to change is fault/exception 
handling.   For example, if there is a problem reading the soap message 
or in an SAAJ handler or similar, the reader and invoker would never get 
called, but a fault would need to be written out.   

Also, on one-way ops, the writer is obviously never called either.

Dan


>
> Cheers, Rob
>
> On Feb 1, 2008 1:27 PM, Daniel Kulp <dk...@apache.org> wrote:
> > Rob,
> >
> > Writing a new databinding is slightly tricky to get completely
> > working correctly.   I don't think we have any good docs for it yet.
> >   The new xmlbeans databinding (on trunk only) is probably the
> > easiest to follow as an example as it doesn't do anything that
> > complex yet.
> >
> > The steps to creating a databinding would be:
> >
> > 1) Write Reader/Writer implementations that read/write to
> > XmlStreamReader/Writers.     In some cases, the runtime also wants
> > readers/writers for nodes, but you can always create a
> > XmlStreamReader/Writer  from the node and feed it into the same
> > impl. JAXB does does some optimizations if it's a node, but for
> > simplicity, the xmlbeans databinding currently doesn't.
> >
> > 2) Write the "DataBinding" object that creates the readers/writers.
> > The tricky part of this is the initizialize(...) method.  It needs
> > to create the schemas and get them plugged into the service model
> > for all the parts so that the generated wsdl will look correct.   
> > For XMLBeans, it was pretty simple as the schemas are in the
> > generated jar.   For each "MessagePartInfo" just need to find the
> > appropriate XmlSchema element or type and set the appropriate
> > fields.
> >
> > 3) Fault handling - this is somewhat optional (xmlbeans doesn't do
> > it yet), but if your databinding has special rules for
> > handling/mapping exceptions, both of the above would need updating
> > for that as well.  A chunk of jaxb's complexity is around that.
> >
> > Anyway, I'd definitely recommend looking at the XmlBeans
> > databinding. The JAXB databinding does a BUNCH of things that makes
> > it very complex.
> >
> > Dan
> >
> > On Wednesday 30 January 2008, Rob Barrett wrote:
> > > I'm about to start some data binding code to map soap messages to
> > > java components and I'm looking at the DataBinding interfaces in
> > > cxf.
> > >
> > > Could anyone point me at a good point of introduction to this
> > > interface/class set. I'd like to find out about the lifecycle of
> > > these things, how/when they are called, etc.
> > >
> > > Thanks, Rob
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: data binding question

Posted by Rob Barrett <ba...@gmail.com>.
Thanks for that Daniel.

Do you know if there's a consistent sequence that cxf forces the
binders and invokers to follow i.e. Reader -> Invoker -> Writer  or if
there are scenarios that should cause the sequnce to change?

Cheers, Rob


On Feb 1, 2008 1:27 PM, Daniel Kulp <dk...@apache.org> wrote:
>
> Rob,
>
> Writing a new databinding is slightly tricky to get completely working
> correctly.   I don't think we have any good docs for it yet.   The new
> xmlbeans databinding (on trunk only) is probably the easiest to follow
> as an example as it doesn't do anything that complex yet.
>
> The steps to creating a databinding would be:
>
> 1) Write Reader/Writer implementations that read/write to
> XmlStreamReader/Writers.     In some cases, the runtime also wants
> readers/writers for nodes, but you can always create a
> XmlStreamReader/Writer  from the node and feed it into the same impl.
> JAXB does does some optimizations if it's a node, but for simplicity,
> the xmlbeans databinding currently doesn't.
>
> 2) Write the "DataBinding" object that creates the readers/writers.
> The tricky part of this is the initizialize(...) method.  It needs to
> create the schemas and get them plugged into the service model for all
> the parts so that the generated wsdl will look correct.    For XMLBeans,
> it was pretty simple as the schemas are in the generated jar.   For
> each "MessagePartInfo" just need to find the appropriate XmlSchema
> element or type and set the appropriate fields.
>
> 3) Fault handling - this is somewhat optional (xmlbeans doesn't do it
> yet), but if your databinding has special rules for handling/mapping
> exceptions, both of the above would need updating for that as well.  A
> chunk of jaxb's complexity is around that.
>
> Anyway, I'd definitely recommend looking at the XmlBeans databinding.
> The JAXB databinding does a BUNCH of things that makes it very complex.
>
> Dan
>
>
>
> On Wednesday 30 January 2008, Rob Barrett wrote:
> > I'm about to start some data binding code to map soap messages to java
> > components and I'm looking at the DataBinding interfaces in cxf.
> >
> > Could anyone point me at a good point of introduction to this
> > interface/class set. I'd like to find out about the lifecycle of these
> > things, how/when they are called, etc.
> >
> > Thanks, Rob
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
>