cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <>
Subject Re: Validate JAXB Object with xsd schema
Date Wed, 03 Dec 2014 11:40:46 GMT
Can you temporarily register a custom CXF JAXBElementProvider extension 
(as a provider) and override its getSchema(Class) method and check if it 
is called ?

A simpler option is to set the schema locations property directly on 
JAXBElementProvider, there was an issue long time ago when the schem,a 
locations property was not set on the provider if it was configured the 
way you do it now but I believe it was fixed...

I guess there's also a way to configure JAXB or Xerces to log the schema 
validation process

You can get the CXF source and put a breakpoint in CXF JAXRS 
AbstractJaxbProvider in the code where Unmarshaller is created to 
confirm the schema is activated

Cheers, Sergey
On 03/12/14 10:06, nikosdim wrote:
> Yes, you are right, there were warnings which i didn't see.
> I changed my configuration to
> <jaxrs:schemaLocation>classpath:../../xsd/incident.xsd</jaxrs:schemaLocation>
> and WARINGS are gone but still when I send an invalid xml, the JAXB object
> is getting created without errors or exceptions.
> How can I check if the xml input is checked against the xsd? What am I
> suppose to get back when an invalid xml is given?
> My project structure is shown below.
> --webapps
>      |--MyProject
>          |--WEB-INF
>              |--classes/
>              |--beans.xml
>              |--web.xml
>          |--xsd
>              |--incident.xsd
> Thanks
> --
> View this message in context:
> Sent from the cxf-user mailing list archive at

View raw message