Configuring JAXRS to do schema validation for only some service beans
I have a Spring-configured CXF-powered JAX-RS service with two service beans:
<jaxrs:server id="wsServices"> <jaxrs:serviceBeans> <ref bean="a"/> <ref bean="b"/> </jaxrs:serviceBeans> <jaxrs:schemaLocations> <jaxrs:schemaLocation> classpath:/schema/webservices.xsd </jaxrs:schemaLocation> </jaxrs:schemaLocations> </jaxrs:server> <bean id="a" class="AServiceImpl"/> <bean id="b" class="BServiceImpl" />
Unfortunately, only one of the two service beans is covered by the XSD file, so that that other one fails at schema validation.
I know how to turn off schema validation altogether, and then both services work fine (but I'd rather continue to have validation where it can be used).
How can I change the configuration to only use schema validation for bean a, but not for b?
Schema validation is set at the JAX-RS service level, so you can't do what you want directly (without adding to the schema) but you can have multiple <jaxrs:server> instances in the same webapp with different paths. That should let you set up what you want without too much trouble. (This is where the more sophisticated configuration approach of CXF comes into its own.)