On Aug 8, 2013, at 10:01 AM, Filipe Amaral <[email protected]> wrote:
> Hi there > > Before putting up my question let me just set up the scenario for you. > > My service contains a series of *javax.xml.ws.handler.Handler*s that do a > bunch of validations/rule check in my request's custom SOAP header element, > let's call it /RequestHeader/. > I've turned on CXF's automatic schema validation and it works on the body. > It has come to my attention that CXF schema validation (JAXB) only runs > after the inbound message traverses all handlers defined in the handler > chain (I think both unmarshalling/marshalling and validation happen around > the same time). > Also, as I stated before, only the body is validated, and not the > /RequestHeader/, although I have specified it in the XSD (and also as a > message and binding operations's header inside my WSDL). > > Q: Is there any way to apply the Schema validation before any handler is > traversed and also to validate the SOAP header? Not easily, no. You could write an interceptor (or even your Handler) that would grab the schemas and perform a validation on it. Since you are using a Handler, you have the full SAAJ model already parsed and in memory so it wouldn't be a huge amount of work to do. Dan > I would like that restrictions and patterns defined in the XSD could be > validated before any computation happens inside my handlers. I realize that > JAXB only has to run after the handler chain cause inside of handlers we > have access to the marshalled request, but this could be a nice feature, > otherwise I'll have to design a specific handler to validate /RequestHeader/ > and add it to my chain and make it the first to run in an inbound message :/ > > Best regards > > > > -- > View this message in context: > http://cxf.547215.n5.nabble.com/Schema-validation-before-Handlers-tp5732112.html > Sent from the cxf-user mailing list archive at Nabble.com. -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
