A web service has many clients. The service may define message structures through proprietary protocols, or by using open standards like XML.
How can a service augment the information it sends or receives while minimizing the probability of breaking changes?
Clients often ask for data structure changes after services have been released. In an effort to accommodate these clients while avoid breaking changes, the service owner may decide to create additional web services to handle client-specific messages and media types. Unfortunately, this usually results in duplicate code. The service owner could try to persuade all client owners to adopt the data requirements of the requestor, but the other client owners might consider the new structures to be irrelevant or unsuitable for their needs.
Service owners in situations like these might therefore modify messages and media types to support Extension Points. These constructs enable new elements and attributes to be added to messages or representations at predefined locations. Unfortunately, this approach tends to increase service complexity, raise the potential for run-time errors, and undermine the expressive power of simple schemas. How can service messages support extensibility in a way that is explicit and self-descriptive, yet does not break client applications that use older structures?
Append optional data to existing request and response data structures.
The Dataset Amendment pattern suggests that service owners should append primitive data or complex data structures to any Data Transfer Object as optional data. Web services can be designed to easily recognize and process amendments when they appear in requests. Since amendments are designated as being optional, the service framework can skip parsing and validation of these elements, and can even hide the content from the client application. This helps to mitigate the risk of breaking changes. It is worth noting that the frameworks which hide unrecognized amendments are often able to preserve this content so that it can sent back to the message originator on to other parties that recognize the content .