WCF 101: First things First
Before digging into Windows Communication Foundation I think it's a good idea to start with the SOA and its related concepts…
What is SOA
As per W3C the service oriented architecture is "A set of components which can be invoked and whose interface descriptions can be discovered and published"
SOA principals
To be able to design and develop a service oriented applications you need to understand the four SOA basic principals which is:
Explicit boundaries:
Messages must cross applications (services) regardless what's behind..
Autonomous services
Simply make each service totally independent regarding its development and deployment (loosely coupled) …
Policy based compatibility
Communication with a specific service comes through its policies regarding security, messaging pattern... etc
Shared Schemas and contracts
Services publish information about the operations that they implement and the structure of the data that they expect to send and receive…
What is a service?
A service is a set of functionality that can be invoked by sending and receiving messages..
What is WCF?
To understand what WCF really is, you need to give a look back to Microsoft disconnected technologies.. ASMX, .NET Remoting, Enterprise Services and COM+. Because WCF is the new age technology to replace them… read more here
WCF architecture
Your WCF application runs above the following four layers:
Read more here
WCF service architecture
By default any WCF service consists of a service description (mostly using WSDL) and one or more endpoints.. read more about WCF service architecture
What is a message?
A message is a packet of data that is being routed from source to a destination.
Soap message structure
SOAP messages .. so Soap messages are structured as follow:
And basically contains the following 3 sections:
Read more here
Also note that WCF messages are not just SOAP or XML.. it could be JSNO or even binary files.
Contracts
Contracts defines certain aspects of the service such as format and structure .. and consists of 3 types:
- Service contracts: defines operations on the service ( web methods in ASMX terminology)
- Message contracts: allows the control of SOAP message data and structure
- Data contracts: defines the data that is being exchanged between a service and its client
Watch this webcast for more information about WCF contracts
Binding
Binding defines how a service communicate with the outside world.. binding properties contains information just like transport pattern, messaging pattern and security pattern.
Addresses
Addresses defines a service endpoint location .. remember each single service may contain multiple endpoints and multiple addresses as well, addresses may use http, tcp, MSMQ or named pipes address.
HTH and happy coding :)