SOA Data Validation Framework: by Kathiravan Udayakumar
SOA Data Validation Framework: by Kathiravan Udayakumar
com/
Payload validation can also be enabled through BPEL Activity (Validate). The below screenshot
shows the BPEL with Validate activity; desired variables can be validated using this technique.
Validation of the service data can also be enabled through the validateXML Partner Link Property for
request – response scenarios.
Payload validation can be enabled in mediator through the configuration in the routing rule. The
below screenshot shows the Mediator with Validate Syntax; it enables to perform XSD schema
validation for all request and reply messages.
Enabling Data Validation through Schematron
I like to point to the readers that we have technique to validate the data through Schematron.
Details of the Schematron and related information will be presented in the following section of the
article.
Introduction to Schematron
Schematron is an XML based language for making assertions about the presence of data patterns in
XML documents. Schematron can be used for Business rules Validation, Data Reporting and etc.
Schematron is very often it is used as a supplement to strengthen XSD grammars. Schematron is an
ISO standard which has used in many industries, notably the financial sector, governmental record
exchange, and in technical and reference publishing. Schematron can be natively accessed from XSL
document and as it is also supported through XPath Expressions.
The Schematron allows us to develop and mix two kinds of schemas:
1. Report elements allow us to diagnose which variant of a language we are dealing with.
2. Assert elements allow us to confirm that the document conforms to a particular schema.
The Schematron works as stated below.
Step 1: It finds a context nodes in the document (typically an element) based on XPath path criteria;
then,
Step 2: It checks to identify if some other XPath expressions are true, for each of those nodes.
Step 3: It Reports the custom message.
The Schematron can be useful in conjunction with many grammar-based structure-validation
languages: DTDs, XML Schemas, RELAX, TREX, etc.
The Code Snippet shown below describes the Schematron file that is used to validate an Order XML
Data Structure for the data validation rules noted below.
1. Order Service Data should contain at-least one item element.
2. Sum of the item price value should match the Order grant total price.
3. Customer’s billing and shipping address should be mandatory in Order XML Structure.
4. Customer id should be mandatory in the Order XML Structure.
5. More than one customer billing and shipping address should not be present in the Order
Order Schema Definition is shown below for benefit of the readers to understand the details
Schematron file.
Listing A: Order Definition (Order.xsd)
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.onlinestore.org/Order"
elementFormDefault="qualified">
<xsd:element name="Order">
<xsd:annotation>
<xsd:documentation>A sample element</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="OrderID"/>
<xsd:element name="OrderDescrtiption"/>
<xsd:element name="TotalOrderValue"/>
<xsd:element name="Items">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="Item">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ProductName"/>
<xsd:element name="Price"/>
<xsd:element name="Units"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CustomerDetails">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CustomerID"/>
<xsd:element name="CustomerName"/>
<xsd:element name="CustomerAddress"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="BillToAddress"/>
<xsd:element name="BillToPhone"/>
<xsd:element name="BillToName"/>
<xsd:element name="ShipToAddress"/>
<xsd:element name="ShipToPhone"/>
<xsd:element name="BillToName"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Problem/Need:
Ability to express the data validation and apply business meaning to its validated results for SOA
Data
Solution Details:
SOA Data Validations can be achieved through Schematron. Business Validation rules can be
centralized suing Schematron files and it can be accessed through Service Layer, Java API or native
XPath. Schematron can also be executed through Ant Scripts but it may not be of great relevance to
SOA.
Framework Component Details
SOA Data Validation Framework contains the WebService API and Schematron Rules. Data Validation
rules will be stored in the Schematron Files and Web Service API will be enabled through SCA Service
Layer for Integration.
Implementation Techniques
Integrating Schematron with Oracle SOA Suite is provided by Mediator. Required number of
validation services can be built using the mediator and it can be called to process the data. In case of
EBS (Enterprise Business Service) or EBF (Enterprise Business Flows ) development; Master
Validation services can be developed using Mediator component to validate the master data to
ensure the validity of the data that is passed through. Below Screenshot shows the options provided
by the mediator configuration to call a Schematron file from Oracle SOA. This would ensure required
service interface is also available through the mediator service components.