I was surprised to see this in EndpointImpl today:
private void addSchemaValidation() {
Schema schema =
EndpointReferenceUtils.getSchema(service.getServiceInfo());
if (service.getDataBinding().getDataReaderFactory() instanceof
JAXBDataReaderFactory) {
((JAXBDataReaderFactory)service.getDataBinding().getDataReaderFactory()).setSchema(schema);
}
if (service.getDataBinding().getDataWriterFactory() instanceof
JAXBDataWriterFactory) {
((JAXBDataWriterFactory)service.getDataBinding().getDataWriterFactory()).setSchema(schema);
}
}
I'm not sure when it got added, but I'm pretty sure this is NOT the
right place for it. I think this is a much more general feature than
just JAX-WS or just JAXB, and hence should be part of the core
functionality.
I think that to solve this we probably want to
a) Give a service reference to the databinding. One way we could do this
is add the Service to the constructor of the JAXBDataBinding. Same would
go for an XmlBeansDatabinding.
b) Create a configuration property to turn on schema validation. This
can then be checked by doing
Boolean.TRUE.equals(message.getContextualProperty(SCHEMA_VALIDATE)).
This way schema validation can be turned on at the request, operation,
or service level.
Cheers,
- Dan
--
Dan Diephouse
(616) 971-2053
Envoi Solutions LLC
http://netzooid.com