cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sergey.beryoz...@iona.com>
Subject Re: REST Spring XML Validation
Date Wed, 22 Jul 2009 19:10:57 GMT

Hi

> Really painful JAXB requires this behavior, why should it care what is the
> root element?

I agree, given that ObjectFactory actually has methods returning
JAXBElements.
Note I've just updated JAXBElementProvider to wrap instances of some
selected types into JAXBElements which should make it possible just to
generate the types and be done with it, JAXBElementProvider will wrap
them...
 
> So the error i am getting is it can not find my type.

you might want to play with @XmlSeeAlso...

Also, you can register ValidationEventHandler with JAXBElementProvider

cheers, Sergey

Nathaniel Auvil wrote:
> 
> the validations kick in but i am getting an error due to what i think is a
> JAXB issue.  When i generated my classes, i had to include a
> @XmlRootElement
> on any of my types which were at the root level.  Really painful JAXB
> requires this behavior, why should it care what is the root element?  Very
> frustrating.
> 
> So the error i am getting is it can not find my type.  The funny thing is,
> i
> cut and pasted the XML from my GET method and am passing it as a "create"
> via POST.  I am going to have to roll my own validation  :(
> 
> 
> 
> 
> On Tue, Jul 21, 2009 at 3:44 PM, Sergey Beryozkin
> <sergey.beryozkin@iona.com
>> wrote:
> 
>>
>> Hi,
>>
>> It's a regression which was reported earlier on the list, due to the fact
>> that every endpoint now has its own ProviderFactory instance. The way
>> this
>> setting was working originally was that the default providers were
>> reflectively checked and injected this property. It's been fixed again
>> and
>> test-verified and should work fine in 2.2.3. In mean time, a valid and
>> faster approach is to explicitly register JAXBElementProvider. see for ex
>> how a schema holder can be registered here :
>>
>>
>> http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/resources/jaxrs/WEB-INF/beans.xml
>>
>> you might want to register this utility holder in cases when you want to
>> have JAXB & JSON providers
>> schema validating and sharing the same schema info.
>> Otherwise just register a util:list of schema locations as a
>> JAXBElementProvider 'schemas' property
>>
>> cheers, Sergey
>>
>>
>>
>> Nathaniel Auvil wrote:
>> >
>> > After a few weeks i have come back to work on my Apache CXF project and
>> my
>> > validation no longer is working.
>> >
>> > I have:
>> >
>> >     <jaxrs:server id="accountService" address="/accountsService">
>> >         <jaxrs:serviceBeans>
>> >             <ref bean="accountsBean" />
>> >         </jaxrs:serviceBeans>
>> >         <jaxrs:schemaLocations>
>> >
>> >
>> <jaxrs:schemaLocation>classpath:machsTypes-v1.xsd</jaxrs:schemaLocation>
>> >         </jaxrs:schemaLocations>
>> >         <jaxrs:providers>
>> >             <ref bean="webAppExceptionMapper" />
>> >         </jaxrs:providers>
>> >         <jaxrs:features>
>> >             <cxf:logging />
>> >         </jaxrs:features>
>> >     </jaxrs:server>
>> >
>> > in my beans.xml but i do not see anything regarding the schema in the
>> > server
>> > log and i am sending invalid XML to and from my serivce without
>> incident.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/REST-Spring-XML-Validation-tp24593149p24593991.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/REST-Spring-XML-Validation-tp24593149p24612665.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message