Category: WCF
view more software Tips and Tricks
Updated: 07/04/2013 04:07 AM
Author: Shiju Mathews Status: Resolved. |
||||||
What are the basics of WCF?
Following are the basics of WCF. 1. EndPointEndpoint is a portal for WCF to communicating with the world. All the WCF communications are take place through end point. Endpoints provide clients access to the functionality offered by a WCF service. End point consists of three components.
(a) Address
(b) Binding A binding has several characteristics, including the following: Transport -Defines the base protocol to be used like HTTP, Named Pipes, TCP, and MSMQ are some type of protocols.
Encoding (Optional) - Three types of encoding are available-Text, Binary, or Message Transmission Optimization Mechanism (MTOM). MTOM is an interoperable message format that allows the effective transmission of attachments or large messages (greater than 64K). Protocol(Optional) - Defines information to be used in the binding such as Security, transaction or reliable messaging capability
(c) Contract
WCF defines four types of contracts.
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. 2. Datacontracts: Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string, but we can easily define explicit opt-in data contracts for custom types.
There are two types of Data Contracts.
DataContract - attribute used to define the class. DataMember - attribute used to define the properties. 3. 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. To know more on Message Contract see Message contract tutorial. 4. 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. |