Chapter 2. Contracts
In Chapter 1, you were introduced to fundamental WCF concepts, including how to create and consume a service, how to host a service and expose endpoints where it can be reached by clients, how to support metadata exchange so that clients can generate service contracts, and how to work with client proxies to invoke service operations. In Chapter 1, you also learned the importance of service metadata, which is shared with clients through a WSDL document. Service metadata includes all of the necessary information for a client to invoke service operations, including:
The address where messages should be sent
The protocols supported by the service, including transport protocol, message encoding format, and other messaging protocols
A list of service operations and the required information to be passed to or returned from those operations
The service contract is the hub of this metadata—defining a set of operations, parameters, and return values. Each service contract represents a group of logically related operations that are exposed through endpoints. Endpoints describe the address where messages can be sent to reach those operations and the other required protocols to process those messages. Services may implement one or more service contracts, and thus may have different logical groupings of operations, but all of this is still ultimately included in the WSDL document.
As discussed in Chapter 1, clients communicate with services by exchanging messages that are serialized ...
Get Learning WCF now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.