Introducing WCF
Difference between WCF and Web service
Sample SOAP message
Introducing WCF
WCF Architecture
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 datatype cannot be identified by the client e.g. Employee data type. By using DataContract 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 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.
Activation and Hosting
- Services can be hosted or executed, so that it will be available to everyone accessing from the client. WCF service can be hosted by following mechanism
- IIS
Internet information Service provides number of advantages if a Service uses Http as protocol. It does not require Host code to activate the service, it automatically activates service code.
- Windows Activation Service
(WAS) is the new process activation mechanism that ships with IIS 7.0. In addition to HTTP based communication, WCF can also use WAS to provide message-based activation over other protocols, such as TCP and named pipes.
- Self-Hosting
WCF service can be self hosted as console application, Win Forms or WPF application with graphical UI.
- Windows Service
WCF can also be hosted as a Windows Service, so that it is under control of the Service Control Manager (SCM).
WCF Experience
Demo of Simple WCF services Host
Services and End Points
Some Build in Bindings
Demo of Simple WCF Client application
Programming Services
WCF Service Model Architecture
Contracts
Define Data Contract
Define Service Contracts
Message Contract
MessageHeaderArray Attribute
Message Contract Properties
Fault Contract
Instancing and Threading
Instance Deactivation
Durable Service
Throttling
Programming Model
Operation Services on WCF
WCF Hosting Services
Address and Bindings
WCF Address
WCF Bindings
Types of Bindings
Metadata Exchange
Service Exceptions
Transfer mode
Events
Transaction
Two-phase committed protocol
Consider the scenario where I am having single client which use single service for communication and interacting with single database. In which service starts and manage the transaction, now it will be easy for the service to manage the transaction.
Consider for example client calling multiple service or service itself calling another service, this type of system are called as Distributed Service-oriented application. Now the questions arise that which service will begin the transaction? Which service will take responsibility of committing the transaction? How would one service know what the rest of the service feels about the transaction? Service could also be deployed in different machine and site. Any network failure or machine crash also increases the complexity for managing the transaction.
Transaction Propagation
Transaction Protocols
Transaction Mode
How to Create WCF Transaction
Demo of SELF Hosting Services
Demo of IIS Hosting Services
Windows Activation Service
Windows Service Hosting
Step 11: Now service is Hosted sucessfully and we can create the proxy class for the service and start using in the client applcaiton.
Blogger Labels: Fundamentals,Part,Difference,Sample,SOAP,message,Architecture,Contracts,layer,Application,Developer,system,Service,Describe,Example,temperature,Operational,Contract,Data,custom,client,schema,definition,Employee,DataContract,parameter,method,Default,communication,requirements,Policies,Specify,requirement,protocol,Runtime,Behavior,Controls,messages,Error,Specifies,Metadata,Tells,Instance,Transaction,Enables,failure,Dispatch,Infrastructure,component,Channels,abstraction,Endpoint,categories,Transport,Handles,Protocols,MSMQ,Implements,Activation,Services,mechanism,Internet,information,advantages,Host,Windows,addition,Self,Forms,Control,Manager,Experience,Demo,Simple,Points,Some,Build,Bindings,Model,Define,MessageHeaderArray,Attribute,Properties,Fault,Deactivation,Durable,Operation,Types,Exchange,Exceptions,Transfer,mode,Events,phase,Consider,scenario,database,machine,Propagation,Create,Step,proxy
Thank you for your guide to with upgrade information
ReplyDeleteDot NET Online Course Hyderabad