Databases Reference
In-Depth Information
Schematron files are deployed to MDS in an identical way to XML
Schemas, as covered in Chapter 11, Designing the Service Contract .
Returning Schematron errors
In the event that one or more assertions are violated within a Schematron, then an
error will be raised by the Mediator and a Fault , similar to the one shown in the
following code snippet, will be returned to the service consumer.
<env:Fault>
<faultcode>env:Server</faultcode>
<faultstring>…Schematronvalidationfailswitherror
<ns1:ValidationErrors>
<error>SecuritycodeforMastercardmustbe3digits.</error>
<error>CreditCardhasexpired.</error>
</ns1:ValidationErrors>
</faultstring>
<faultactor/>
<detail>
<exception/>
</detail>
</env:Fault>
Using Schematron with the Service Bus
The Service Bus does not support Schematron validation. However, it does provide a
Java Callout Action that allows you to invoke a Java method within a message flow.
One approach would be to implement a lightweight Java class that wraps the
Schematron classes and exposes a single method, which can then be invoked
using a Java Action in the Service Bus.
Putting validation in the underlying
service
So far we have looked at using XML Schema and Schematron to put validation either
in the service contract or the Mediator layer in order to provide initial validation of a
service invocation, before we actually invoke the underlying service. This provides a
number of benefits, including:
 
Search WWH ::




Custom Search