it appears with 1.5.9 that you either get validators and one class for each method for our service with a lot of xml or you get a single class with all the method in it that's annotated. life would be so much easier if there was a @Validation annotation that you could map a validator to method endpoint.
so what i've done is this,.
Code:
private void validateBusinessRules(TowRequest request, String objName, Class errorBindingClass) {
//@SuppressWarnings({"ThrowableInstanceNeverThrown"})
Errors errors = new BindException(errorBindingClass, objName);
_towWebServiceValidator.validate(request, errors);
if (errors.hasErrors()) {
StringBuffer errorMsg = new StringBuffer();
for (ObjectError objectError : errors.getAllErrors()) {
errorMsg.append(objectError.getCode()).append(" : ").append(objectError.getDefaultMessage()).append("\n");
}
throw new TowWebServiceException("Validation Erorrs:\n" + errorMsg);
}
}
this method is the first thing that's call in each of my method endpoints.
my ServiceValidator is a factory that figures out what type of validator i need and invokes my validation.