The patterns in this chapter describe how to structure a custom-developed solution in a service-oriented environment. Specifically, these patterns enable you to:
Expose application functionality as a service
Encapsulate the details of consuming services that are exposed by other applications
Figure 6.4 shows the relationship between a service gateway, a service interface, and the implementation of the service.
Figure 6.4: Service elements
As you design service oriented systems, it is helpful to separate the elements that are responsible for application business logic from those elements responsible for communicating with services and participating in service contracts. Separating these elements furthers the general design objective of separation of concerns, and improves maintainability, flexibility, and testability.
The Service Interface pattern provides guidance on structuring the service provider portion of the contract. It discusses using a service interface component that encapsulates the details of communicating with a particular set of service consumers and invokes a service implementation component that performs the actual business logic associated with the service Implementing Service Interface in .NET then provides a concrete example of creating a service interface component using the .NET framework.
The Service Gateway design pattern provides guidance for implementing the service consumer portion of the contract. It discusses using a service agent component that encapsulates all the low-level details of communicating with the service and exposes an interface that is optimized for the use of the other components within the service consumer application. Implementing Service Gateway in .NET then provides a concrete example of creating a Service Gateway component using the .NET Framework.