You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by allam-di14 <al...@hotmail.com> on 2014/03/07 22:47:11 UTC

Re: @XmlRootElement with jax-rs/jax-ws

Hello Sergey, 

As a continuation to this discussion, I would like to know please if there
is a JSON provider in cxf which :
1) works without adding @XmlRootElement on classes
2) allows using @XmlJavaTypeAdapter JAXB annotation for handling interfaces,
ex:
public void op( 
    		@XmlJavaTypeAdapter(InterfaceAdapter.class) 
    		ResourceInterface r);



I tried org.apache.cxf.jaxrs.provider.json.JSONProvider, but it requires
adding  @XmlRootElement on classes. I tried also
org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider, which works without
adding 
@XmlRootElement, but it didn't treat the @XmlJavaTypeAdapter.

Could I have an idea please how to use my adapter class (InterfaceAdapter)
with JAX-RS for JSON?

Kind regards,
Diana  



--
View this message in context: http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5740975.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: @XmlRootElement with jax-rs/jax-ws

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 12/03/14 11:42, Diana ALLAM wrote:
> It seems that in cxf, (I am working on 2.7.10 version), the jaxbValidationEventHandler is active for SOAP only and not for RESTful, is it right?
> I concluded this because when I forced to use JAXElement for unmarshalling in RESTful, my service can avoid unexpected elements without any exception.
> While in SOAP, I suppose that by default, all my classes are unmarshalled as JAXBElement, (because I don't have any JAXB annotation in my classes),
> but I still have to set the JAXB validation handler to false in order to avoid the thrown exception.
You can use that property with CXF JAXBDataBinding if you prefer, in 
scope of working with JAX-RS endpoints (using the delegating 
DataBindingProvider or the data binding property).

If you bypass it and work directly with JAX-RS JAXB-aware providers 
(JAXBElementProvider, JSONProvider) and force JAXBElement reading then 
then you need to set ValidationEventHandler directly on them. The actual 
schema validation can be enforced separately too

Cheers, Sergey
>
> Am I right?
>
> Kind regards,
>
> Diana
>
>
>
> On 12 mars 2014, at 12:16, Sergey Beryozkin wrote:
>
>> The code shows that if this property is enabled then JAXB ValidationEventHandler implementation is set...
>>
>> Cheers. Sergey
>> On 11/03/14 16:31, Diana ALLAM wrote:
>>> Thank you for your reply.
>>> I have a last question please.
>>> Could I have more implementation details about "set-jaxb-validation-event-handler", which is used in the beans.xml file in jaxws;properties?
>>> I know that JAXB allows adding handlers to marshaller, unmarshaller or validator.
>>> Does the "set-jaxb-validation-event-handler" correspond to a particular cxf Handler? If yes, which is exactly please?
>>> I have the cxf source code, and I see that "set-jaxb-validation-event-handler" is used in DataReaderImpl, but it's difficult to get how it works.
>>>
>>> Regards,
>>> Diana
>>>
>>>
>>>
>>> On 11 mars 2014, at 16:45, Sergey Beryozkin wrote:
>>>
>>>> You can use StaxTransformFeature to drop unexpected elements (such as Description) or XSLTTransformFeature, follow the links at the end of
>>>>
>>>> http://cxf.apache.org/docs/featureslist.html
>>>>
>>>> Cheers, Sergey
>>>>
>>>>
>>>> On 11/03/14 13:23, allam-di14 wrote:
>>>>> I have the following operation op provided by a server:
>>>>> void op(A a)
>>>>>
>>>>> Such that A has two attributes "key" and "value".
>>>>>
>>>>> I would like to invoke this operation using the following payload:
>>>>> Payload:
>>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>>> 	<soap:Body>
>>>>> 		<ns3:op xmlns:ns2="http://test/" xmlns:ns3="http://server/">
>>>>> 			<arg0>
>>>>> 				<key>1</key>
>>>>> 				<value>Diana</value>
>>>>> 				<description>PHD</description>
>>>>> 			</arg0>
>>>>> 		</ns3:op>
>>>>> 	</soap:Body>
>>>>> </soap:Envelope>
>>>>>
>>>>> This payload has an additional element "description", at unmarshalling, the
>>>>> following exception is thrown:
>>>>> org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element
>>>>> (uri:"", local:"description"). Expected elements are <{}value>,<{}key>
>>>>> 	at
>>>>> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881)
>>>>> 	at
>>>>> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702)
>>>>> ...
>>>>>
>>>>> This exception is due to JAXB validation Event Handler.
>>>>> I can get rid of it with the following spring configuration :
>>>>> <jaxws:properties>
>>>>> 	<entry key="schema-validation-enabled" value="false" />	
>>>>> 	<entry key="set-jaxb-validation-event-handler" value="false" />
>>>>> </jaxws:properties>
>>>>>
>>>>> But disabling the JAXB validator is not a good thing.
>>>>> I would like to do it better by unmarshalling my payload as JAXBElement,
>>>>> because it will ignore the additional XML elements.
>>>>>
>>>>> Regards,
>>>>> Diana
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context: http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5741094.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
>>>>
>>>
>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>

Re: @XmlRootElement with jax-rs/jax-ws

Posted by Diana ALLAM <al...@hotmail.com>.
It seems that in cxf, (I am working on 2.7.10 version), the jaxbValidationEventHandler is active for SOAP only and not for RESTful, is it right?
I concluded this because when I forced to use JAXElement for unmarshalling in RESTful, my service can avoid unexpected elements without any exception.
While in SOAP, I suppose that by default, all my classes are unmarshalled as JAXBElement, (because I don't have any JAXB annotation in my classes), 
but I still have to set the JAXB validation handler to false in order to avoid the thrown exception.

Am I right? 

Kind regards,

Diana

 

On 12 mars 2014, at 12:16, Sergey Beryozkin wrote:

> The code shows that if this property is enabled then JAXB ValidationEventHandler implementation is set...
> 
> Cheers. Sergey
> On 11/03/14 16:31, Diana ALLAM wrote:
>> Thank you for your reply.
>> I have a last question please.
>> Could I have more implementation details about "set-jaxb-validation-event-handler", which is used in the beans.xml file in jaxws;properties?
>> I know that JAXB allows adding handlers to marshaller, unmarshaller or validator.
>> Does the "set-jaxb-validation-event-handler" correspond to a particular cxf Handler? If yes, which is exactly please?
>> I have the cxf source code, and I see that "set-jaxb-validation-event-handler" is used in DataReaderImpl, but it's difficult to get how it works.
>> 
>> Regards,
>> Diana
>> 
>> 
>> 
>> On 11 mars 2014, at 16:45, Sergey Beryozkin wrote:
>> 
>>> You can use StaxTransformFeature to drop unexpected elements (such as Description) or XSLTTransformFeature, follow the links at the end of
>>> 
>>> http://cxf.apache.org/docs/featureslist.html
>>> 
>>> Cheers, Sergey
>>> 
>>> 
>>> On 11/03/14 13:23, allam-di14 wrote:
>>>> I have the following operation op provided by a server:
>>>> void op(A a)
>>>> 
>>>> Such that A has two attributes "key" and "value".
>>>> 
>>>> I would like to invoke this operation using the following payload:
>>>> Payload:
>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>> 	<soap:Body>
>>>> 		<ns3:op xmlns:ns2="http://test/" xmlns:ns3="http://server/">
>>>> 			<arg0>
>>>> 				<key>1</key>
>>>> 				<value>Diana</value>
>>>> 				<description>PHD</description>
>>>> 			</arg0>
>>>> 		</ns3:op>
>>>> 	</soap:Body>
>>>> </soap:Envelope>
>>>> 
>>>> This payload has an additional element "description", at unmarshalling, the
>>>> following exception is thrown:
>>>> org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element
>>>> (uri:"", local:"description"). Expected elements are <{}value>,<{}key>
>>>> 	at
>>>> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881)
>>>> 	at
>>>> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702)
>>>> ...
>>>> 
>>>> This exception is due to JAXB validation Event Handler.
>>>> I can get rid of it with the following spring configuration :
>>>> <jaxws:properties>
>>>> 	<entry key="schema-validation-enabled" value="false" />	
>>>> 	<entry key="set-jaxb-validation-event-handler" value="false" />
>>>> </jaxws:properties>
>>>> 
>>>> But disabling the JAXB validator is not a good thing.
>>>> I would like to do it better by unmarshalling my payload as JAXBElement,
>>>> because it will ignore the additional XML elements.
>>>> 
>>>> Regards,
>>>> Diana
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> View this message in context: http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5741094.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
>>> 
>> 
> 
> 
> -- 
> Sergey Beryozkin
> 
> Talend Community Coders
> http://coders.talend.com/
> 
> Blog: http://sberyozkin.blogspot.com
> 


Re: @XmlRootElement with jax-rs/jax-ws

Posted by Sergey Beryozkin <sb...@gmail.com>.
The code shows that if this property is enabled then JAXB 
ValidationEventHandler implementation is set...

Cheers. Sergey
On 11/03/14 16:31, Diana ALLAM wrote:
> Thank you for your reply.
> I have a last question please.
> Could I have more implementation details about "set-jaxb-validation-event-handler", which is used in the beans.xml file in jaxws;properties?
> I know that JAXB allows adding handlers to marshaller, unmarshaller or validator.
> Does the "set-jaxb-validation-event-handler" correspond to a particular cxf Handler? If yes, which is exactly please?
> I have the cxf source code, and I see that "set-jaxb-validation-event-handler" is used in DataReaderImpl, but it's difficult to get how it works.
>
> Regards,
> Diana
>
>
>
> On 11 mars 2014, at 16:45, Sergey Beryozkin wrote:
>
>> You can use StaxTransformFeature to drop unexpected elements (such as Description) or XSLTTransformFeature, follow the links at the end of
>>
>> http://cxf.apache.org/docs/featureslist.html
>>
>> Cheers, Sergey
>>
>>
>> On 11/03/14 13:23, allam-di14 wrote:
>>> I have the following operation op provided by a server:
>>> void op(A a)
>>>
>>> Such that A has two attributes "key" and "value".
>>>
>>> I would like to invoke this operation using the following payload:
>>> Payload:
>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>> 	<soap:Body>
>>> 		<ns3:op xmlns:ns2="http://test/" xmlns:ns3="http://server/">
>>> 			<arg0>
>>> 				<key>1</key>
>>> 				<value>Diana</value>
>>> 				<description>PHD</description>
>>> 			</arg0>
>>> 		</ns3:op>
>>> 	</soap:Body>
>>> </soap:Envelope>
>>>
>>> This payload has an additional element "description", at unmarshalling, the
>>> following exception is thrown:
>>> org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element
>>> (uri:"", local:"description"). Expected elements are <{}value>,<{}key>
>>> 	at
>>> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881)
>>> 	at
>>> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702)
>>> ...
>>>
>>> This exception is due to JAXB validation Event Handler.
>>> I can get rid of it with the following spring configuration :
>>> <jaxws:properties>
>>> 	<entry key="schema-validation-enabled" value="false" />	
>>> 	<entry key="set-jaxb-validation-event-handler" value="false" />
>>> </jaxws:properties>
>>>
>>> But disabling the JAXB validator is not a good thing.
>>> I would like to do it better by unmarshalling my payload as JAXBElement,
>>> because it will ignore the additional XML elements.
>>>
>>> Regards,
>>> Diana
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context: http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5741094.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
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: @XmlRootElement with jax-rs/jax-ws

Posted by Diana ALLAM <al...@hotmail.com>.
Thank you for your reply.
I have a last question please.
Could I have more implementation details about "set-jaxb-validation-event-handler", which is used in the beans.xml file in jaxws;properties?
I know that JAXB allows adding handlers to marshaller, unmarshaller or validator.
Does the "set-jaxb-validation-event-handler" correspond to a particular cxf Handler? If yes, which is exactly please?
I have the cxf source code, and I see that "set-jaxb-validation-event-handler" is used in DataReaderImpl, but it's difficult to get how it works.

Regards,
Diana 



On 11 mars 2014, at 16:45, Sergey Beryozkin wrote:

> You can use StaxTransformFeature to drop unexpected elements (such as Description) or XSLTTransformFeature, follow the links at the end of
> 
> http://cxf.apache.org/docs/featureslist.html
> 
> Cheers, Sergey
> 
> 
> On 11/03/14 13:23, allam-di14 wrote:
>> I have the following operation op provided by a server:
>> void op(A a)
>> 
>> Such that A has two attributes "key" and "value".
>> 
>> I would like to invoke this operation using the following payload:
>> Payload:
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>> 	<soap:Body>
>> 		<ns3:op xmlns:ns2="http://test/" xmlns:ns3="http://server/">
>> 			<arg0>
>> 				<key>1</key>
>> 				<value>Diana</value>
>> 				<description>PHD</description>
>> 			</arg0>
>> 		</ns3:op>
>> 	</soap:Body>
>> </soap:Envelope>
>> 
>> This payload has an additional element "description", at unmarshalling, the
>> following exception is thrown:
>> org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element
>> (uri:"", local:"description"). Expected elements are <{}value>,<{}key>
>> 	at
>> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881)
>> 	at
>> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702)
>> ...
>> 
>> This exception is due to JAXB validation Event Handler.
>> I can get rid of it with the following spring configuration :
>> <jaxws:properties>
>> 	<entry key="schema-validation-enabled" value="false" />	
>> 	<entry key="set-jaxb-validation-event-handler" value="false" />
>> </jaxws:properties>
>> 
>> But disabling the JAXB validator is not a good thing.
>> I would like to do it better by unmarshalling my payload as JAXBElement,
>> because it will ignore the additional XML elements.
>> 
>> Regards,
>> Diana
>> 
>> 
>> 
>> 
>> --
>> View this message in context: http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5741094.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
> 


Re: @XmlRootElement with jax-rs/jax-ws

Posted by Sergey Beryozkin <sb...@gmail.com>.
You can use StaxTransformFeature to drop unexpected elements (such as 
Description) or XSLTTransformFeature, follow the links at the end of

http://cxf.apache.org/docs/featureslist.html

Cheers, Sergey


On 11/03/14 13:23, allam-di14 wrote:
> I have the following operation op provided by a server:
> void op(A a)
>
> Such that A has two attributes "key" and "value".
>
> I would like to invoke this operation using the following payload:
> Payload:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> 	<soap:Body>
> 		<ns3:op xmlns:ns2="http://test/" xmlns:ns3="http://server/">
> 			<arg0>
> 				<key>1</key>
> 				<value>Diana</value>
> 				<description>PHD</description>
> 			</arg0>
> 		</ns3:op>
> 	</soap:Body>
> </soap:Envelope>
>
> This payload has an additional element "description", at unmarshalling, the
> following exception is thrown:
> org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element
> (uri:"", local:"description"). Expected elements are <{}value>,<{}key>
> 	at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881)
> 	at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702)
> ...
>
> This exception is due to JAXB validation Event Handler.
> I can get rid of it with the following spring configuration :
> <jaxws:properties>
> 	<entry key="schema-validation-enabled" value="false" />	
> 	<entry key="set-jaxb-validation-event-handler" value="false" />
> </jaxws:properties>
>
> But disabling the JAXB validator is not a good thing.
> I would like to do it better by unmarshalling my payload as JAXBElement,
> because it will ignore the additional XML elements.
>
> Regards,
> Diana
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5741094.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

Re: @XmlRootElement with jax-rs/jax-ws

Posted by allam-di14 <al...@hotmail.com>.
I have the following operation op provided by a server:
void op(A a)

Such that A has two attributes "key" and "value".

I would like to invoke this operation using the following payload:
Payload:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	<soap:Body>
		<ns3:op xmlns:ns2="http://test/" xmlns:ns3="http://server/">
			<arg0>
				<key>1</key>
				<value>Diana</value>
				<description>PHD</description>
			</arg0>
		</ns3:op>
	</soap:Body>
</soap:Envelope>

This payload has an additional element "description", at unmarshalling, the
following exception is thrown:
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element
(uri:"", local:"description"). Expected elements are <{}value>,<{}key> 
	at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881)
	at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702)
...

This exception is due to JAXB validation Event Handler.
I can get rid of it with the following spring configuration :
<jaxws:properties>
	<entry key="schema-validation-enabled" value="false" />	
	<entry key="set-jaxb-validation-event-handler" value="false" />
</jaxws:properties>

But disabling the JAXB validator is not a good thing.
I would like to do it better by unmarshalling my payload as JAXBElement,
because it will ignore the additional XML elements.

Regards,
Diana




--
View this message in context: http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5741094.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: @XmlRootElement with jax-rs/jax-ws

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi,
On 11/03/14 12:46, Diana ALLAM wrote:
> Hi Sergey,
>
> Thank you for your reply, that works very good.
> Do you know please if there is a similar configuration in Spring for JAXWS in order to marshall/unmarshall as JAXBElements?
> I tried to create an ObjectFactory class with JAXBElements methods but that does not work.
>
I'm not sure, I thought it is not needed for JAX-WS endpoints to have 
JAXB beans qualified with XmlRootElement, how would you like to use such 
beans in JAX-WS ?

Cheers, Sergey
> Kind regards,
> Diana
>
>
> On 9 mars 2014, at 22:45, Sergey Beryozkin wrote:
>
>> Hi Diana
>>
>> JSONProvider can be configured to read into beans without XmlRootElement, set its unmarshallAsJaxbElement property to true, the runtime checks the adapters, this is independent of the actual providers
>> being used
>>
>> Cheers, Sergey
>>
>>
>> On 07/03/14 21:47, allam-di14 wrote:
>>> Hello Sergey,
>>>
>>> As a continuation to this discussion, I would like to know please if there
>>> is a JSON provider in cxf which :
>>> 1) works without adding @XmlRootElement on classes
>>> 2) allows using @XmlJavaTypeAdapter JAXB annotation for handling interfaces,
>>> ex:
>>> public void op(
>>>      		@XmlJavaTypeAdapter(InterfaceAdapter.class)
>>>      		ResourceInterface r);
>>>
>>>
>>>
>>> I tried org.apache.cxf.jaxrs.provider.json.JSONProvider, but it requires
>>> adding  @XmlRootElement on classes. I tried also
>>> org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider, which works without
>>> adding
>>> @XmlRootElement, but it didn't treat the @XmlJavaTypeAdapter.
>>>
>>> Could I have an idea please how to use my adapter class (InterfaceAdapter)
>>> with JAX-RS for JSON?
>>>
>>> Kind regards,
>>> Diana
>>>
>>>
>>>
>>> --
>>> View this message in context: http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5740975.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
>>
>

Re: @XmlRootElement with jax-rs/jax-ws

Posted by Diana ALLAM <al...@hotmail.com>.
Hi Sergey, 

Thank you for your reply, that works very good.
Do you know please if there is a similar configuration in Spring for JAXWS in order to marshall/unmarshall as JAXBElements?
I tried to create an ObjectFactory class with JAXBElements methods but that does not work.

Kind regards,
Diana 


On 9 mars 2014, at 22:45, Sergey Beryozkin wrote:

> Hi Diana
> 
> JSONProvider can be configured to read into beans without XmlRootElement, set its unmarshallAsJaxbElement property to true, the runtime checks the adapters, this is independent of the actual providers
> being used
> 
> Cheers, Sergey
> 
> 
> On 07/03/14 21:47, allam-di14 wrote:
>> Hello Sergey,
>> 
>> As a continuation to this discussion, I would like to know please if there
>> is a JSON provider in cxf which :
>> 1) works without adding @XmlRootElement on classes
>> 2) allows using @XmlJavaTypeAdapter JAXB annotation for handling interfaces,
>> ex:
>> public void op(
>>     		@XmlJavaTypeAdapter(InterfaceAdapter.class)
>>     		ResourceInterface r);
>> 
>> 
>> 
>> I tried org.apache.cxf.jaxrs.provider.json.JSONProvider, but it requires
>> adding  @XmlRootElement on classes. I tried also
>> org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider, which works without
>> adding
>> @XmlRootElement, but it didn't treat the @XmlJavaTypeAdapter.
>> 
>> Could I have an idea please how to use my adapter class (InterfaceAdapter)
>> with JAX-RS for JSON?
>> 
>> Kind regards,
>> Diana
>> 
>> 
>> 
>> --
>> View this message in context: http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5740975.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
> 


Re: @XmlRootElement with jax-rs/jax-ws

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Diana

JSONProvider can be configured to read into beans without 
XmlRootElement, set its unmarshallAsJaxbElement property to true, the 
runtime checks the adapters, this is independent of the actual providers
being used

Cheers, Sergey


On 07/03/14 21:47, allam-di14 wrote:
> Hello Sergey,
>
> As a continuation to this discussion, I would like to know please if there
> is a JSON provider in cxf which :
> 1) works without adding @XmlRootElement on classes
> 2) allows using @XmlJavaTypeAdapter JAXB annotation for handling interfaces,
> ex:
> public void op(
>      		@XmlJavaTypeAdapter(InterfaceAdapter.class)
>      		ResourceInterface r);
>
>
>
> I tried org.apache.cxf.jaxrs.provider.json.JSONProvider, but it requires
> adding  @XmlRootElement on classes. I tried also
> org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider, which works without
> adding
> @XmlRootElement, but it didn't treat the @XmlJavaTypeAdapter.
>
> Could I have an idea please how to use my adapter class (InterfaceAdapter)
> with JAX-RS for JSON?
>
> Kind regards,
> Diana
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5740975.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