Service API Patterns, Protocols, Coupling Types, Metrics > Service API Proxy and Gateway Patterns > Data Model Transformation
Data Model Transformation
How can a service API facilitate consumer programs with differing data exchange requirements?
For services to exchange any form of structured data (such as business documents), the definition of the model that the data structure is based on (the data model) can be different at transmitting and receiving ends. This leads to a requirement for the runtime transformation of information from one data model into another.
With the application of the Data Model Transformation pattern, data model transformation logic can be introduced to carry out the runtime conversion of data, so that data complying with one data model can be restructured to comply with a different data model. This extends a non-standardized messaging framework, enabling it to dynamically overcome disparity between the schemas used by a service API and messages transmitted to that contract.
The service consumer uses the Process Claims schema to represents a claim record, while Service A uses its own Claims schema. The two schemas structure the same data differently and are therefore incompatible. The data model transformation logic invoked by the service API proxy converts the Process Claims schema into a schema compatible with the Claims schema structure, without making changes to the required data itself.