Hi

On Wed, Sep 22, 2010 at 3:29 PM, Kampf, Eric <[email protected]> wrote:

> Hello.
>
> I am working on an OSGI web application that uses CXF.  We have a number of
> existing  service classes exposed via SOAP.  We would now like to expose
> REST versions of these  services.  When I built the first REST service, I
> was surprised to see that the XML it produced did not match the XML of its
> SOAP counterpart.  Element name casing differed and collections were
> represented differently.
>
> While it is not an absolute requirement that the XML structures match, it
> is highly desirable.  We have used the SOAP XML to predict the REST XML and
> coded clients against this.
>
> One obvious solution would be to use JAXB annotations, but that is not an
> allowable option at this time.
>
> What I am looking for is a way to configure CXF so that it uses the same
> marshaling "mode" for both REST and SOAP.  I have read the section of the
> CXF manual on JAXB configuration, but it did not have the detail I was
> looking for.  My JAXB knowledge is a bit light.
>
> I have seen this behavior with CXF 2.2.6 and 2.2.10.
>
> Any guidance would be greatly appreciated.  Thanks.
>
>
Give us more information please.
- I'm assuming you're using JAXB data binding for SOAP services ? Asking it
because Aegis can probably deal with JAXB annotations too.

- is it CXF HTTP Binding or JAXRS that you use ? If you use CXF JAXRS then
you should be able to use the same JAXBDatabinding that you use for SOAP
services, use jaxrs:dataBinding.

http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml

- you might want to try the legacy CXF Http Binding - it is probably capable
of producing exactly the same xml (
http://cxf.apache.org/docs/http-binding.html). JAX-RS does not impose any
restrictions on the way XML should look like - example, in case of JAXB it
is whatever JAXB will produce will be sent over as is...

- please post some sample SOAP response and expected non-SOAP response,
sample service class (with a single service method) and sample bean which
will have to be serialized. May be some trivial transformation (via
configuring JAXRS JAXBElementProvider) will do...Specifically, see
outTransformMap property :

http://cxf.apache.org/docs/jax-rs.html#JAX-RS-CustomizingJAXBXMLandJSONinputandoutput

For example, you may configure the provider to transform various local names
as needed

cheers, Sergey




> -Eric
>

Reply via email to