cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From diana-cxfUser allam-cxfUser <allamcxfuser2...@gmail.com>
Subject Re: JAX-RS: marshalling/unmarshalling between cxf 2.5 and cxf 2.7
Date Thu, 13 Jun 2013 16:09:36 GMT
Hello,

What is the provider exactly?
For the marshaling process, I understood that there are a DataWriter and a
DataBinding instance (JAXB by default).
I suppose that, in the cxf 2.4, the JAXBDataBinding instance (
http://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxb/JAXBDataBinding.html#JAXBDataBinding%28java.lang.Class...%29)
has Resource2 class as a context.
In cxf 2.7, JAXBDataBinding instance has Resource1 class as a context.
Is the provider a specific class in cxf which specifies the Data Binding
context?

I have another question please: Are  the marshalling/unmarshalling results
the same for all data bindings? for example Aegis?
SDO, Json Data Bindings and others implemented in Cxf?
In cxf, there are different DataReaders and DataWriters for each data
binding.
Does that modify the marshalling/unmarshalling of messages?
Indeed, by considering a POJO approach, is there a real difference between
these data bindings?
Except performance criterion maybe and the ability to convert some
particular XML syntax into Java?

Regards,

Diana



On Thu, Jun 13, 2013 at 5:34 PM, Sergey Beryozkin <sberyozkin@gmail.com>wrote:

> Hi
>
> On 13/06/13 15:22, allam wrote:
>
>> Hello,
>>
>> I have a restful service which implements the following interface:
>> @Path("/service/")
>> public interface ServiceInterface {
>>
>>      @POST
>>      @Path("/resources/")
>>      public void op(Resource1 r);
>>
>> }
>>
>> and I have two classes Resource1 and Resource2, such that Resource2
>> extends
>> Resource1.
>> (I am not using @XmlSeeAlso annotation in Resource1 class to bind on
>> Resource2 class).
>> I would like to call the service method op, using an instance of
>> Resource2.
>>
>> Before, by using CXF 2.5, the Resource2 instance is marshalled to the
>> following XML :
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>> <resource2>
>>     <attr1>default</attr1>
>>     <attr2>0</attr2>
>> </resource2>
>>
>> and an exception is thrown at reception because the expected root element
>> is
>> "resource1" not "resource2".
>>
> That is correct I guess
>
>
>> While by using CXF 2.7, the Resource2 instance is marshalled to the
>> following XML:
>> <resource1>
>>     <attr1>default</attr1>
>> </resource1>
>>
>> And there isn't any exception at reception.
>> That means, in CXF 2.5, the marshalling type was the dynamic type, while
>> in
>> the cxf 2.7 version, the marshalling type is the static type.
>> What does make this change between the two versions?
>> and for which reason this modification was done between the two versions?
>>
> In CXF 2.5.x the actual object instance class was reported to the
> providers, in CXF 2.7.x - the class of the method parameter, which is
> correct.
> The fact that no exception is reported is good. I think you need now to
> use XmlSeeAlso or may be configure JAXBElementProvider to report xsi:type
> if needed, etc, and on the client side, check please
>
> http://cxf.apache.org/docs/**jax-rs-data-bindings.html#JAX-**
> RSDataBindings-**CommonJAXBandJSONconfiguration<http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-CommonJAXBandJSONconfiguration>
>
> Cheers, Sergey
>
>
>
>>
>> Regards,
>>
>> Diana
>>
>>
>>
>>
>> --
>> View this message in context: http://cxf.547215.n5.nabble.**
>> com/JAX-RS-marshalling-**unmarshalling-between-cxf-2-5-**
>> and-cxf-2-7-tp5729200.html<http://cxf.547215.n5.nabble.com/JAX-RS-marshalling-unmarshalling-between-cxf-2-5-and-cxf-2-7-tp5729200.html>
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message