- Validate messages when they are constructed and thus before they are sent.
- Generate Java classes from the XML schema for use in XML binding frameworks.
- Easily construct mock XML messages with a tool like XMLSpy for use in (unit)tests or mock implementations of services.
With “well defined schema” I mean a schema definition which is constructed before the actual service is implemented so every element in the schema is well thought out. Another example: when some element’s value is an enumeration of some values, define this in the schema definition and not in a separate document (I,ve seen it happen). This way you restrict the values an element can contain and it becomes much easier to construct mock XML messages for testing purposes.
The bottom line is: invest in the construction of well thought out service contracts.
A good reference for designing XML schema definitions can be found here.