3 March 2014

WCF Architecture


  The major components  of WCF service 

 Contracts:

    Contracts layer are next to that of Application layer. Developer will directly use this contract to develop the service. We are also going to do the same now. Let us see briefly what these contracts will do for us and we will also know that WCF is working on message system.

Service contracts:

     Describe about the operation that service can provide. Example, Service provided to know the temperature of the city based on the zip code, this service we call as Service contract. It will be created using Service and Operational Contract attribute.

Data contract:

     It describes the custom data type which is exposed to the client. This defines the data types, 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 type cannot be identified by the client e.g. Employee data type. By using Data Contract we can make client aware that we are using Employee data type for 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.

Policies and Binding:

    Specify conditions required to communicate with a service e.g. security requirement to communicate with service, protocol and encoding used for binding.

Service Runtime:

   It contains the behaviors that occur during runtime of service.
  • Throttling Behavior- Controls how many messages are processed.
  • Error Behavior - Specifies what occurs, when internal error occurs on the service.
  • Metadata Behavior - Tells how and whether metadata is available to outside world.
  • Instance Behavior - Specifies how many instance of the service has to be created while running.
  • Transaction Behavior - Enables the rollback of transacted operations if a failure occurs.
  • Dispatch Behavior - Controls how a message is processed by the WCF Infrastructure.
Messaging:

   Messaging layer is composed of channels. A channel is a component that processes a message in some way, for example, by authenticating a message. A set of channels is also known as a channel stack. Channels are the core abstraction for sending message to and receiving message from an Endpoint.

   Broadly we can categories channels as Transport Channel and Protocol Channel

Transport Channels:

    Handles sending and receiving message from network. Protocols like HTTP, TCP, name pipes and MSMQ.

Protocol Channels:

     Implements SOAP based protocol by processing and possibly modifying message. E.g. WS-Security and WS-Reliability.








No comments:

Post a Comment