In this recipe, we will show you how to reference Schematron defined in MDS to validate an incoming message within Mediator. This approach enables us to separate the validation rules for the actual composite, allowing us to change our validation rules without having to redeploy a compoite.
Make sure you have created a file-based MDS repository for JDeveloper, as described at the start of this chapter, and that it contains a valid Schematron file.
Create an SOA application with a project containing Mediator (see the Create a Mediator using a WSDL in MDS recipe in this chapter).
This will bring up the Validations window where you can specify one or more Schematron files for the routing rule.
For Part, select the part of the SOAP message to which you want t apply the validation.
When we reference Schematron in this way, JDeveloper doesn't add a copy of Schematron to the composite; rather within the Mediator plan, it sets the schematron
element to reference the location of Schematron in MDS.
At runtime, when the composite references Schematron, it will use the one deployed to the SOA infrastructure, MDS Database repository.
This has a number of distinct advantages. Firstly, you can ensure that all your composites use the same version of a particular Schematron.
Secondly, if you need to modify your validation rules, you simply need to update a single copy of your Schematron and redeploy it to MDS. Any composite that references that Schematron will automatically pick up the modified version, without the need to be re-deployed.