Databases Reference
In-Depth Information
The eighth message is the response returned by our composite. Again, we should be
confident in the quality of the data returned.
With these assumptions in mind, the key point of validation is any message received
through the service interface exposed by the composite (that is, message number
one). Assuming we are following the best practice (as covered in Chapter 10 , oBay
Introduction ), our composite will contain a Mediator that acts as the entry point to
our composite.
The Mediator component provides support for XSD and Schematron validation.
Thus this provides the ideal point to implement validation, as it allows us to provide
a centralized point within our composite for implementing all validation as well as
ensuring that we perform the validation early on within the flow.
We also need to ensure that adequate validation is provided for messages exchanged
with the External Service , so we will cover how we can implement this using OSB.
Using XML Schema validation
The interface for each service is defined by its WSDL contract, with the core
structure of the data being exchanged defined by one or more XML Schemas. So XSD
validation provides an excellent way to implement the initial level of validation.
When implementing schema-based validation, we have two basic approaches, that
is, to either implement strongly-typed web services or loosely-typed services.
Strongly-typed services
With strongly-typed services, we use XML Schema to very precisely specify the exact
structure of each element within our XML instance. For example, if we look at the
definition of a credit card within the oBay canonical model, a strongly-typed version
may be defined as the following code snippet:
<xsd:complexTypename="tCreditCard">
<xsd:sequence>
<xsd:elementname="cardType"type="tCardType"/>
<xsd:elementname="cardHolderName"type="tCardHolderName"/>
<xsd:elementname="cardNumber"type="tCardNumber"/>
<xsd:elementname="expiryMonth"type="tExpiryMonth"/>
<xsd:elementname="expiryYear"type="tExpiryYear"/>
<xsd:elementname="securityNo"type="tSecurityNo"/>
</xsd:sequence>
</xsd:complexType>
 
Search WWH ::




Custom Search