Windows communication foundation provides a new flexible service mechanism in the service oriented architecture. we can better handle services , better handle the running services environment on our host, so that we can optimize the throughput of our application. WCF is basically a SDK for developing services on windows platform but consumption could be any platform. The main feature that I like as a developer, that it is “provide a runtime environment for services. I consume and developed singleton pattern, session base webservices easily and consume through different client. In WCF we have a better security mechanism, that mean client never talk to the host(server) services for any request, there is an isolation between server and client for security, here comes the interoperability, that mean how the service communicate with other service or client, which tell WCF to create an isolation gap between client and host, whenever client request for data, WCF never directly connect with the host, instead the contracts in WCF play a role in middle to handshake data between two. here we can have whole detail of WCF interoperability and integration. Data is secure and encrypted. Visual studio 2010 provides a new visual interface to configure the configuration of wcf service, by which we can defined the bindings of our service easily.

wcfwebconfig WCF

wcfwebconfig WCF

Nnow first let’s talk about the Cs of WCF which we called the contracts. Service contracts are like the advertisement to the consumer of your service, like we defined an interface which tell us about the service methods which are going to expose to the consumer, and this take place through a schema and a contract definition..

Today, that schema is either a Web Services Description Language (WSDL) contract or a WS-MetadataExchange (MEX) contract. These formats are industry-supported, open specifications. These specifications are located at the following locations: WSDL: http://www.w3.org/TR/wsdl MEX: http://schemas.xmlsoap.org/ws/2004/09/mex/.

Sontracts describes which operations the client can perform on the service, provide a mechanism in middle to handshake request between client and host. There are two types of Service Contracts. ServiceContract – This attribute is used to define the Interface.

OperationContract – This attribute is used to define the method inside Interface.

[ServiceContract] interface IMyContract { [OperationContract] string MyMethod( ); } class MyService : IMyContract { public string MyMethod( ) { return “Hello World”; } }

Data contracts Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string,

There are two types of Data Contracts.

DataContract – attribute used to define the class

DataMember – attribute used to define the properties.

[DataContract] class Contact { [DataMember] public string FirstName; [DataMember] public string LastName; } If DataMember attributes are not specified for a properties in the class, that property can’t be passed to-from web service.

Fault contracts Define which errors are raised by the service, and how the service handles and propagates errors to its clients.

Message contracts Allow the service to interact directly with messages. Message contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format we have to comply with.Type message mean that we have already define our schema and working on that particular schema, but untype mean that we are handling any xml message without defining its type. Basically type and untype I found in Bizalk orchestration development, if we have schema (XSD) which is provided by the vender that this message will be called as our type message.

Address in WCF Address is a way of letting client know that where a service is located. In WCF, every service is associated with a unique address. This contains the location of the service and transport schemas.

WCF supports following transport




Peer network

IPC (Inter-Process Communication over named pipes)

Bindings : Actually tells that how our application is gong to communicate with out of the world , it tells what are the protocols, encoding, specify transport which is required between client and the server,we can easily see the binding element in the app.config in our appliaiton which tell the communication transport.

WCF has opened a new multidimensional way for SOA in the Id industry. We have millions of options, I have an experience in developing a big applicaiton in a single day by reusing web services at my work place.


One thought on “ABC’S of WCF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s