Now I am going deeper into contracts and study messaging protocols (TCP, MSMQ, HTTP or named pipes), SOAP, WS*, WSDL and so on. WCF relies on standards to serialize messages, for instance SOAP (1.1 or 1.2) which describes a general format for messages. When messages need to be secure and reliable WS-* plays an essential role. There is a long list of WS-* protocols and some of them are well-adopted like WS-Addressing, WS-MetadataExchange, WS-Policy, MTOM, WS-Security, WS-Trust and WS-SecureConversation, WS-Reliable Messaging and WS-AtomicTransaction. All of them are very lengthy described in documents and can found at W3C or OASIS. A shorter version or overview I found in for instance an msdn article written by Aaron Skonnard. I have downloaded the code of that same article and had a spin on it using VS 2008 Beta 2. Converting the code to use in VS 2008 was no problem and sample worked fine. There are some more great explanations of reliable messaging on the web like Reliable Messaging Simplified and WCF: Reliable Message Delivery. Another great article (overview) about WS-* can be found at InfoQ written by Michele Leroux Bustamante (yep same as author of Learning WCF I currently reading and doing WCF labs from).
Services implement one or more endpoints, each supporting different set of operations, messaging protocols, message encoding formats and transport protocols. Well this information about a service is part of its metadata and can be viewed as the service description. WCF represents this info at runtime as ServiceDescription type from System.ServiceModel namespace. This type is used to generate the WSDL document. Through SvcUtil proxies can be generated for clients through (A) WS-MetadataExchange or (B) a WSDL document.
In WCF application requirements are described by contracts and there are three types that clients (consumer) and services (provider) rely on to control messaging.
Service Contract describes operations supported by a service, message exchange patterns used and format of each message. A WCF service has at least one service contract and the following attributes play an important role in defining it: ServiceContractAttribute, OperationContractAttribute and MessageParameterAttribute. These attributes provide control over the way messages are formatted. In a lab inside learning WCF book this exercised. And that is what I am going to now.