Web Service Contract Versioning Fundamentals Part I: Versioning and Compatibility
Join the DZone community and get the full member experience.
Join For FreeWeb services have made it possible to build services with fully
decoupled contracts that leverage industry standards to establish a
vendor-neutral communications framework. Though powerful and flexible,
this framework brings with it an on-going responsibility to effectively
manage those service contracts as the services continue to evolve over
time. One of the most critical aspects of service governance is
contract versioning. This first of two articles, comprised of excerpts
from the recently released “Web Service Contract Design &
Versioning for SOA” book, explores fundamental service contract issues,
including compatible and incompatible versioning requirements. By Thomas Erl, David Orchard and James Pasley
The
following article is an excerpt from the new book "Web Service Contract
Design and Versioning for SOA" [REF-1] Copyright 2008 Prentice
Hall/Pearson PTR and SOA Systems Inc. Note that chapter references were
intentionally left in the article, as per requirements from Prentice
Hall.

Introduction

After a Web service contract is deployed, consumer programs will naturally begin forming dependencies on it. When we are subsequently forced to make changes to the contract, we need to figure out:
• | whether the changes will negatively impact existing (and potentially future) service consumers |
• | how changes that will and will not impact consumers should be implemented and communicated |
• | What exactly constitutes a new version of a service contract? What’s the difference between a major and minor version? |
• | What do the parts of a version number indicate? |
• | Will the new version of the contract still work with existing consumers that were designed for the old contract version? |
• | Will the current version of the contract work with new consumers that may have different data exchange requirements? |
• | What is the best way to add changes to existing contracts while minimizing the impact on consumers? |
• | Will we need to host old and new contracts at the same time? If yes, for how long? |


Basic Concepts and Terminology

The Scope of a Version

As we’ve established many times over in this book, a Web service contract can be comprised of several individual documents and definitions that are linked and assembled together to form a complete technical interface.

For example, a given Web service contract can consist of:
• | one (sometimes more) WSDL definitions |
• | one (usually more) XML Schema definitions |
• | some (sometimes no) WS-Policy definitions |
• | a centralized XML Schema definition will commonly be used by multiple WSDL definitions |
• | a centralized WS-Policy definition will commonly be applied to multiple WSDL definitions |
• | an abstract WSDL description can be imported by multiple concrete WSDL descriptions or vice versa |

Of all the different parts of a Web service contract, the part that establishes the fundamental technical interface is the abstract description of the WSDL definition. This represents the core of a Web service contract and is then further extended and detailed through schema definitions, policy definitions, and one or more concrete WSDL descriptions.

When we need to create a new version of a Web service contract, we can therefore assume that there has been a change in the abstract WSDL description or one of the contract documents that relates to the abstract WSDL description. How the different constructs of a WSDL can be versioned is covered in Chapter 21. The Web service contract content commonly subject to change is the XML schema content that provides the types for the abstract description’s message definitions. Chapter 22 explores the manner in which the underlying schema definitions for messages can be changed and evolved.

Finally, the one other contract-related technology that can still impose versioning requirements but is less likely to do so simply because it is a less common part of Web service contracts is WS-Policy. How policies in general relate to contract versioning is explained as part of the advanced topics in Chapter 23.

Fine and Coarse-Grained Constraints

Versioning changes are generally related to the increase or reduction of the quantity or granularity of constraints. Therefore, let’s briefly recap the meaning of the term constraint granularity in relation to a type definition. Note the highlight parts of the following example:
<xsd:element name="LineItem" type="LineItemType"/>
Example 1: A complexType construct containing fine and coarse-grained constraints.
<definitions name=”Purchase Order” targetNamespace= Example 2: The addition of a new operation represents a common backwards-compatible change.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
Example 3: In an XML Schema definition, the addition of an optional element is also considered backwards compatible.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" Example 4: To support forwards compatibility within a message definition generally requires the use of XML Schema wildcards.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
Example 5: The default value of the minOccurs attribute is “1”.
Therefore because this attribute was previously absent from the
productName element declaration, it was considered a required element.
Adding the minOccurs=”0” setting turns it into an optional element,
resulting in a compatible change.
We will also be exploring techniques whereby changes
that are not normally compatible can still be implemented as compatible
changes.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" Example 6: Incrementing the minOccurs attribute value of any
established element declaration is automatically an incompatible change.
![]() ![]() Conclusion ![]() Part II of this article series demonstrate the use of version identifiers and discuss three common versioning strategies, each of which has its own rules and conventions. ![]() ![]() References ![]() [REF-1] "Web Service Contract Design and Versioning for SOA" by Thomas Erl, Anish Karmarkar, Priscilla Walmsley, Hugo Haas, Umit Yalcinalp, Canyang Kevin Liu, David Orchard, Andre Tost, James Pasley for the "Prentice Hall Service-Oriented Computing Series from Thomas Erl", Copyright 2008 Prentice Hall/Pearson PTR and SOA Systems Inc., http://www.soabooks.com/wsc/ |
Opinions expressed by DZone contributors are their own.
Trending
-
Web Development Checklist
-
What Is Istio Service Mesh?
-
Building A Log Analytics Solution 10 Times More Cost-Effective Than Elasticsearch
-
Playwright JavaScript Tutorial: A Complete Guide
Comments