WCF Basics Information

WCF Means : Windows Communication Foundation

Windows Communication Foundation (Code named Indigo) is a programming platform and run-time system for building, configuring and deploying network-distributed services. It is the latest service oriented technology; Interoperability is the fundamental characteristics of WCF. It is unified programming model provided in .Net Framework 3.0. WCF is a combined feature of Web Service, Remoting, MSMQ and COM+. WCF provides a common platform for all .NET communication.
Features of WCF

Service Orientation
Interoperability
Multiple Message Patterns
Service Metadata
Data Contracts
Security
Multiple Transports and Encodings
Reliable and Queued Messages
Durable Messages
Transactions
AJAX and REST Support
Extensibility

Advantages 

WCF services provide better reliability and security in compared to ASMX web services.

WCF is interoperable with other services when compared to .Net Remoting where the client and service have to be .Net.
==============================================================

A WCF service is exposed to the outside world as a collection of endpoints.


1. Endpoint: Endpoint is a construct at which messages are sent or received (or both). Endpoint comprises of ABC’s    

ABC’s 
A. Address - Address is a location that defines where messages can be sent
B. Binding - Binding is a specification of the communication mechanism (a binding) that described how messages should be sent
C. Contract - Contract is a definition for a set of messages that can be sent or received (or both) at that location (a service contract) that describes what message can be sent.

2. Service: A construct that exposes one or more endpoints, with each endpoint exposing one or more service operations.

3. Contracts: A contract is a agreement between two or more parties for common understanding and it is a is a platform-neutral and standard way of describing what the service does. In WCF, all services expose contracts.


Different Types of Bindings supported in WCF

BasicHttpBinding

Basic Web service communication. No security by default

WSHttpBinding

Web services with WS-* support. Supports transactions

WSDualHttpBinding

Web services with duplex contract and transaction support

WSFederationHttpBinding

Web services with federated security. Supports transactions

MsmqIntegrationBinding

Communication directly with MSMQ applications. Supports transactions

NetMsmqBinding

Communication between WCF applications by using queuing. Supports transactions

NetNamedPipeBinding

Communication between WCF applications on same computer. Supports duplex contracts and transactions

NetPeerTcpBinding

Communication between computers across peer-to-peer services. Supports duplex contracts

NetTcpBinding

Communication between WCF applications across computers. Supports duplex contracts and transactions


Different Contracts In WCF:

Service Contract

Service contracts describe the operation that service can provide. For Eg, a Service provide to know the temperature of the city based on the zip code, this service is called as Service contract. It will be created using Service and Operational Contract attribute.

Data Contract

Data contract describes the custom data type which is exposed to the client. This defines the data types, which are passed to and from service. Data types like int, string are identified by the client because it is already mention in XML schema definition language document, but custom created class or data types cannot be identified by the client e.g. Employee data type. By using DataContract we can make client to be aware of Employee data type that are returning or passing parameter to the method.

Message Contract

Default SOAP message format is provided by the WCF runtime for communication between Client and service. If it is not meeting your requirements then we can create our own message format. This can be achieved by using Message Contract attribute.

Fault Contract

Suppose the service I consumed is not working in the client application. I want to know the real cause of the problem. How I can know the error? For this we are having Fault Contract. Fault Contract provides documented view for error occurred in the service to client. This helps us to easy identity, what error has occurred.

0 comments:

Post a Comment

Vikram Chandra Theme by BloggerThemes & NewWPThemes Sponsored by iBlogtoBlog