Monday, 22 June 2015

Windows Communication Foundation (WCF)

Windows Communication Foundation (WCF) WCF is a platform where we can build any application which is use for intercommunication in distributed application using predefined and well defined Interface.It is part of .Net 3.0
Or
It is a platform where we can create services for the distributed application
Services: It is a collection of component which takes the request of one or multiple users give the corresponding response.

 Difference between Component and Class?

  Homogeneous application---- Class
  Heterogeneous application---- Component

 Note: - Those class which work on heterogeneous application is called components.

 What is Distributed Application?
It is an application where part of run on two or more computer nodes.It is also called Connected System

For Example: A web application is running on one machine and a web services that this application is consuming on another application
Why build Distrubuted Application?

1.    An enterprise application may need to use the services provides by another enterprise
     For example: An IRCTC Indian Railways application may be using Payment Getway                  services for payments
2.    For better scalability : An enterprise application may  have Presention tier,Business tier and Data Acess tier and each tier running on different machine


What is Interoperable Application?  An application that can communicate with any other application that is build on any plateform is called as an interoperable application
For Example Web services are interoperable application where as .net remotig services are not means .Net Remoting can consumed only by another .net application but Web Services can communicate with any application built on any plateform

What is technology choice did we have befour WCF build distributed application

  • Enteprise Services
  • DotNet Remoting
  • Web Services
The first client is using a java application to intract with our services, so for Interoperability this client wants message to be xml format and protocal to be http.
Without WCF to satify the first client requirement we end up implementing and ASMX services

The second client uses .Net so for better performance this client wants message formated in binary over TCP protocal
The satisfied the second client requirement we end up implementing a remoting services

 Web services and .Net Remoting two different technologies, and here complete different progaming models so that developers have to learn different technologies so to  unify and bring all the these comunication technology under one roof Microsoft has come up with a single programing model that called as WCF
With Windows Communication Foundation (WCF):  We implement one services and we can configure as many end point as want to support all the client needs.To support above two client requirement, we
would configure two end point .
              
In the End Point configuration we specify the protocals and message formats that we want to use

Service-Oriented Architecture (SOA) is an architectural pattern in computer software design in which application components provide services to other components via a communications protocol, typically over a network. The principles of service-orientation are independent of any vendor, product or technology.

 Principle of  SOA

1)    Services: - It is collection of Component which take request and give response.
2)    Services Consumer: - Who use your service.
3)    Services Provider: - Who provide service to the consumer.
4)    Services Registry: - We hold all address of services.
5)    Services Contract : - Which provider use your service and which consumer use your service
6)    Services Leas: - Time duration.
7)    Message: - The amount of data transfer to server to client is called message. And you can transfers data in WCF  in any format
8)    Service Proxy: - A virtual copy of service on client is called services proxy.
9)    Service Advertise and Discover: - It checks the process is valid or not using URL of Services.

End Point of WCF: - It is also called A, B, C in WCF

  1. A  Address (Where)
  2. B Binding (How)
  3. C Contract (What)                  



 End Point:  It is nothing but it is like a port that interacts with server.

1) A for Address: - It is nothing, but it is a URL of Service

2) B for Binding: - the visual studio 4.0 or above.

·         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
(above four different binding use for Internet and Security purpose)
·         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
(and this above binding use for Intranet,LAN or Single System )

      3) C for Contract: -

  1.   Service Contract (Predefined data type )
  2.  Data Contract(User defined data type)
  3. Message Contract (SOA  architecture for changing protocol )
  4.   Fault Contract   ( Error)





0 comments:

Post a Comment