WCF stands for Windows Communication Foundation with the code name “Indigo”. It is Application User Interface used to create distributed applications using .NET Framework. System.ServiceModel is the name space that is responsible to utilize WCF Concepts.
WCF application is a service, collection of end points in order to communicate with client or service applications. In order to serialize data we make use of System.Runtime.Serialization name space.
Addresses The location of service in the form of URI. These are the expose points of services.
Bindings How they communicate with the protocol For ex: The type of network protocol used in WCF.
Contracts the methods exposed by WCF defines the contract.
This attribute that is applied to interfaces in WCF service.
This is the contract that is applied to methods that are implementing WCF interface.
Channel If client and server wanted to interact with each other . They need to go through the channel that has input message at one end and the other end as results message.
Intermediaries as the name suggests these are programs that act as "middle-man”. They are commonly invisible to the client and services.ex: a firewall ,gateway
Open VS2008 or VS2010 and Create a New Project->WCF->WCF Service Library Project as shown below.
You have the Service1.svc.cs and IService1.svc.cs in WCF Project
IService.cs is the WCF interface and Service is where exactly you will implement the interface.
You already had methods as GetDataUsingDataContract(), GetData() as methods.
Let us implement one method called GetEmpID()in WCF Service.cs that gets the GUID .
We need to add an operational contract and define a method in IService interface.
Operational contract is mandatory to create WCF service or use WCF method
Create OperationContract in IService1.cs
string GetEmpID(string empId);
Append the below lines of code in the Service1.svc.cs that implements IService interface
public string GetEmpID(string EmpId)
EmpId = Guid.NewGuid().ToString();
Running WCF Service using Visual Studio 2008
Visual Studio itslef creates WCF Test client for theservice where we can test the demo service working or not.
Press invoke button
You can also examine the XML File that contains soap headers in the with xml tabs
And also config file in the config section.