Java Reference
In-Depth Information
Designing Schema for SOA
Problem
You want to define your data types with XML Schema to use within your SOA, but Schema
is so flexible that you aren't sure how to do it. You want to follow patterns and best practices
for Schema that make the most sense specifically in an SOA context.
Solution
Follow one of the Schema design patterns discussed here: Russian Doll, Salami Slice, or
Venetian Blind.
There are several generally accepted design patterns that apply when creating XML schemas.
The inherent flexibility that XML Schema affords means that it can be difficult to figure out
how to start writing them in a consistent, clear manner that will give you the perfect combina-
tion of expressiveness, flexibility, and strong-enough typing. This is all aggravated when your
aim is to design them for an SOA in a way that allows you both to generate to Java code and
to use as raw XML.
Schema defines basic building blocks for defining entities: simple types, complex types, ele-
ments, and attributes. Beyond these, there are many choices to make regarding global or local
types, namespace qualification, and more. Making uninformed choices at this level can crush
your SOA, inadvertently limiting its flexibility. Without careful schema design, you could
work very hard to make loosely coupled services that are composed using orchestrations and
brokered ESBs for different domains, only to suddenly find that in reality the services in your
SOA are very tightly coupled at the root because of a poor choice in schema design. A simple
schema change here could force you to redeploy whole sets of service compositions.
But XML is at the heart of your SOA, and you want to use the considerable power of Java
while maintaining the flexibility that XML gives you. You can have it both ways, but you just
need to think about the ramifications of your schema design choices. In this section, we'll look
at three well-known design patterns for constructing schemas: Russian Doll, Salami Slice,
and Venetian Blind. There are two others that people sometimes employ: Garden of Eden and
Chameleon, which we'll have to discuss in the following recipe because of the attractive nuis-
ance it makes.
The patterns here are generally differentiated by one thing: whether or not your elements and
types are globally defined. A global element or type is one that is a child of the schema node.
Search WWH ::




Custom Search