Demonstrating the usage of the validate mediator for XML schema validation and using local registry (local entries) for storing configuration metadata.
This example shows how a static XML fragment could be stored in the the Synapse local registry. Resources defined in the local registry are static (i.e. never changes over the lifetime of the configuration) and may be specified as a source URL, in-line text or in-line xml. In this example the schema is made available under the key 'validate_schema'.
The validate mediator by default operates on the first child element of the SOAP body. You may specify an XPath expression using the 'source' attribute to override this behaviour. The validate mediator in this sample uses the 'validate_schema' resource to validate the incoming message, and if the message validation fails it invokes the 'on-fail' sequence of mediators.
If you send a stockquote request using the 'ant stockquote ...' command as follows you will get a fault back with the message 'Invalid custom quote request' as the schema validation fails. This is because the schema used in the example expects a slightly different message than what is created by the stock quote client. (i.e. expects a 'stocksymbol' element instead of 'symbol' to specify the stock symbol)