Hi

I haven't uploaded the updated schema to the Apache web site yet...Perhaps
such updates can indeed be done as part of the release builds.
Also, may be we can consider introducing a common set of elements like
databinding/etc which can be used by both ja...@endpoint and jaxrs:server
elements. 

You can share a databinding bean between jaxws and jaxrs endpoints by
referring to it from both jaxws:databinding and jaxrs:databiding element.

CXF DataBindings were introduced before JAXRS has been implemented. It's
only recently that CXF JAXRS started supporting them. So as far the support
for schema-driven (data)bindings is concerned, one can rely on either
JAXBElementProvider or XMLBeansElementProvider (contributed to CXF awhile
back) or CXF DataBindings.

If a user does both JAXWS and JAXB and especially if a databinding bean has
already been configured for JAXWS then reusing the same bean for JAXRS may
also of of interest. Even if it's JAXRS only one may want to try using
databindings.

However CXF DataBindings need to be told in advance (by the JAXRS runtime)
about all the input and output classes/types that may need to be handled
during the lifetime of a given application. If a resource class depends on
subresources which can not be statically resolved (for ex when locator
methods return Objects). In such cases CXF JAXRS providers
(JAXBElementProvider, etc) will work better, they may also have some
configuration options one can't apply to databindings. Also at the moment
the way CXF JAXRS initializes DataBindings is not ideal and we've introduced
a PropertiesAwareDataBinding interface to make this initialization work
better.  

Going forward, I think it will make sense to continue working toward a
common codebase, as far as the support for databindings in CXF is concerned. 

Does it makes things a bit clearer ? 

cheers, Sergey 
 
P.S 'DataBingings' - I think I spotted the typo you referred to :-)



KARR, DAVID (ATTCINW) wrote:
> 
> Comments below.
> 
>> -----Original Message-----
>> From: KARR, DAVID (ATTCINW)
>> Sent: Friday, September 04, 2009 9:29 AM
>> To: [email protected]
>> Subject: Starting to investigate schema-driven bindings with JAXRS
>> 
>> I now have a trivial prototype using JAXRS.  I now want to investigate
>> adding some elements of realism :) , by adding schema-driven bindings,
>> even from fake schemas.  My current prototype uses a hand-written
>> "@XmlRootElement" annotation on the class that represents the root of
>> the response message.  I'd like to investigate how to define the root
>> element and bindings in Spring and associated configuration files.  I
>> see some scattered pieces of how to do this, but I'm having some
>> trouble
>> figuring out how these pieces fit together.  I know that CXF uses JAXB
>> by default, although XMLBeans is an option.  Why would someone choose
>> one over the other?
>> 
>> I see examples of a "jaxws:dataBinding" element in various samples, but
>> the "jaxrs" samples don't do anything like that.   Can I simply have a
>> "jaxws:dataBinding" element inside the "jaxrs:server" element?
>> 
>> I see the documentation briefly mentions (with no examples) that
>> specifying a "jaxbElementClassNames" property is how you could use
>> element classes that you can't add "@XmlRootElement" annotations to
>> (like, if they were generated).  There's barely any mention of that
>> property name in the entire CXF distribution.
> 
> I also noticed the following in the JAX-RS section of the manual (note the
> obvious typo :) ):
> --------
> Support for CXF DataBingings
> 
> Starting from CXF 2.2.3 it is now possible to register a CXF DataBinding
> bean using a jaxrs:databinding element and it will be wrappped as a JAXRS
> MessageBodyReader/Writer provider capable of dealing with XML-based
> content. It can be of special interest to users combining JAX-RS and
> JAXWS. Thus CXF JAXB, Aegis, SDO and XMLBeans databindings can be easily
> plugged in.
> JSON support is also available for all these databindings.
> Please see this configuration file for some examples.
> 
> Similarly to the default JSONProvider these DataBinding-aware JSON
> provider can have "namespaceMap", "serializeAsArray", "arrayKeys",
> "dropRootElement" and "writeXsiType" properties set. Additionally they may
> also have an "ignoreMixedContent" property set.
> 
> Note that at the moment this feature is not available when a cxf-jaxrs
> bundle is used (except for Aegis).
> --------------
> 
> The "Please see this configuration file" is a link to <
> http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml>,
> which this is an excerpt of:
> --------------
> <jaxrs:server id="jaxbbook" address="/jaxb">
> −
> <jaxrs:serviceBeans>
> <ref bean="serviceBean"/>
> </jaxrs:serviceBeans>
> −
> <jaxrs:dataBinding>
> <bean class="org.apache.cxf.jaxb.JAXBDataBinding"/>
> </jaxrs:dataBinding>
> </jaxrs:server>
> --------------
> 
> Here's a "jaxrs:dataBinding" element, but I don't see that in the current
> jaxrs schema.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Starting-to-investigate-schema-driven-bindings-with-JAXRS-tp25297620p25312450.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to