You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Diana ALLAM <al...@hotmail.com> on 2014/03/05 21:13:16 UTC

How to disable JAXB validation for JAXRS

Hello,

I have a spring configuration for a RESTful service in order to use  "org.apache.cxf.jaxb.JAXBDataBinding" 
as a data binding. 
Here is the content of my beans.xml file:

	<jaxrs:server id="testRestful" address="/">
		
		<jaxrs:serviceBeans>
			<ref bean="myService" />
		</jaxrs:serviceBeans>
		<jaxrs:features>
			<cxf:logging />
		</jaxrs:features>
		<jaxrs:dataBinding>
        	<bean class="org.apache.cxf.jaxb.JAXBDataBinding" >
    			<constructor-arg index="0" ref="globalContext"/>
			</bean>
			<entry key="set-jaxb-validation-event-handler" value="false" />
    	</jaxrs:dataBinding>
		
	</jaxrs:server>
	<bean id="myService" class="server.Service" />
	
	<bean id= "globalContext" class="server.GlobalContext" factory-method="getJAXBContext"/>

I would like to disable the JAXB validation (I am not talking here about schema validation) 
to avoid the validation done by javax.xml.bind.ValidationEventHandler.
In JAXWS, I know how to do it:
It is sufficient to add:
<entry key="set-jaxb-validation-event-handler" value="false" />
under <jaxws:properties>.

I tried to do the same for jaxrs, but it doesn't work.
Is there maybe another way to do it?

I would like also to know to which class method/attribute the "set-jaxb-validation-event-handler" corresponds?

Kind regards,

Diana