Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAX-WS request validation using JAXB

In JAX-WS, to validate the incoming request, one of the ways is to use @SchemaValidation as suggested in below link.

JAX-WS and XSD Validation

However the application server (WAS 7) I am using does not yet support @SchemaValidation. (Please correct me if WAS 7 does support this annotation)

So I am looking at other options like implementing a handler to validate the incoming request. Either in the handler or the endpoint class itself, I can create the JAXBContext and use the JAXB validator. Do I need to create the JAXBContext explicitly or is it available as a resource / annotation since JAX-WS internally uses JAXB? Is this a good way to implement validation in JAX-WS? (In the absence of @SchemaValidation validation)

Is it a standard practice to validate the incoming request xml in web services or is it given a skip due to performance hit it might take?

like image 872
PrasadB Avatar asked Nov 24 '11 11:11

PrasadB


1 Answers

It is a good practice to validate the incoming request xml as is the case with every MVC system. (MVC might not fit here but in principle, its same just that the view is XML). If the mentioned annotation (@SchemaValidation) is not supported, then one way out is is use handler which will validate the incoming request using JAXB Validation.

like image 171
Santosh Avatar answered Oct 21 '22 23:10

Santosh