Wednesday, August 6, 2008

More JAX-RI secrets @SchemaValidation

One of the nice things about the RI is that you keep on coming across nice little extensions in the com.sun.xml.* tree. Unfortunately many are not even documented so you only find they by reading the daily posts on the jax-ws forum.

Take for example which allows you to validate incoming schemas. Many might say that this is a needless hit and duck typing is fine; but in certain debugging cases it would be nice to have some control over the validation failure process.

By default it uses but you can replace this with your own implementation to perform what-ever tracing and debuging you need. Normally you would have any control of this as the service would probably fail before the databinding stage.

@ValidationErrorHandler(handler = CustomValidationFailureLogging.class)
public OrderProcessing

Well worth downloading the source code to see what goodies you are missing?


Chris Muir said...

Hi Gerard

In having a look at this feature today, do you agree this is the same as specifying the @SchemaValidation handler with the handler class specified? ie.


I wonder what happens if you specify both?

Do you have any idea in using the @ValidationErrorHandler annotation, what class does the specified handler class need to extend? Presumably



Chris Muir said...

Ah, in looking at this further the ValidationErrorHandler isn't a valid annotation. So I take it the only approach is to use the @SchemaValidation annotation anyhow.