XML schema validation in Java and schema design
1. RPC vs. Document
Quoted from http://blogs.wwwcoder.com/iknow/archive/2005/10/09/8112.aspx
(1) Completeness
In RPC, the XML schema exists for each and every parameter with a definition to the parameter type but not to the message itself.
In Document, the XML schema available is applied for the whole message itself rather than the parameters alone. This is the functionality that lacks in RPC / Literal.
In RPC, apart from the schema that is available for the parameters there are other RPC rules required to send the data and receive the data across the wire and also to validate the message.
In Document, Each message contains no or one part. Each part points to a schema element definition that describes the whole content of the message in the SOAP body.
(2) Flexibility
In RPC, as the request message contains the element that contains the method name and its parameters there is a tight coupling between the consumer and the provider. So they don’t form a loosely coupled architecture when compared to Document / Literal style.
In Documents, as there are no mapping of method names and the parameters in both the request and response messages the coupling between the consumer and provider is very loosely coupled. The changes in the provider won’t affect the consumer to change.
2. Use XML validation in Java
Quoted from http://www.cityjams.com/dataml/articles/ValidateXMLSchema/part1.htm