Two systems are communicating via XML messages on a message queue and any received message must be validated for structure, content and business logic before being processed.
An XML schema offers validation on structure and content with data type restriction, required fields, choice structures and the like.
But this of course only gets me half way there. In a system I am currently working on, we do the remaining validation by deserializing the message to an object structure and validating context with a dedicated code library.
The problem is that first of all the validation is in two different places and it overlaps a bit since some validation can be done in both ways, and secondly maintaining the validation code can become tedious.
Is there a better way to do this, any best practices or tools out there?