Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dhananjay Kumar MVP-Connected System 1. WCF  Agenda What is WCF ? Why WCF? Address, Binding, Contract End Points Hosting Message Patterns Programming.

Similar presentations


Presentation on theme: "Dhananjay Kumar MVP-Connected System 1. WCF  Agenda What is WCF ? Why WCF? Address, Binding, Contract End Points Hosting Message Patterns Programming."— Presentation transcript:

1 Dhananjay Kumar MVP-Connected System 1

2 WCF  Agenda What is WCF ? Why WCF? Address, Binding, Contract End Points Hosting Message Patterns Programming Model Basic Task Cycle 2

3 From Objects to Services PolymorphismEncapsulationSubclassing Message-basedSchema+Contract Binding via Policy 1980s 2000s Interface-based Dynamic Loading Runtime Metadata 1990s Object-Oriented Service-Oriented Component-Based

4 Services and consumers are independently versioned, deployed, operated, and secured. Autonomous Evolution Data never includes behavior; Objects with data and behavior are a local phenomenon. Share schema & contract, not class Capabilities and requirements represented by a unique public name; Used to establish service suitability. Compatibility based on policy Developers opt-in to consuming, exposing, and defining public-facing service façade. Boundaries are Explicit The Four Tenets of Service-Orientation

5 Facilitates implementation/platform interop Independent deployment, versioning, mgmt Promotes technology reuse Benefits of Service Orientation

6 The Challenge Radically Simplifying Distributed Application Development Development of connected systems remains costly and frustrating Different programming models for different tasks Need for security and reliable messaging Interoperability with applications on other platforms Productive service-oriented programming model needed

7 WCF Unified framework for rapidly building service-oriented applications

8  What is WCF ? Service Oriented programming model to develop connected applications. SDK to develop and deploy services on windows. Unifies the existing suite of.Net distributed technologies into a single programming model. 8 Microsoft Innovation & Practice Team, MSCoE

9 Unifies today’s distributed technology stacks Compose able functionality “The unified programming model for rapidly building service- oriented applications on the Windows platform” WS-* interoperability with applications running on other platforms Interoperability with today’s distributed stacks WCF Design Goals Unification Interoperability & Integration Service-oriented programming model Supports 4 tenets of service-orientation ProductiveService-OrientedProgramming

10 Services and Clients ClientService Message Message

11 Endpoints ClientService Message EndpointEndpoint Endpoint

12 End Points End Point BindingAddressContracts Microsoft Innovation & Practice Team, MSCoE 12

13 Address, Binding, Contract ClientService Message ABCABC ABC AddressBindingContract (Where)(How)(What)

14 WCF Architecture: Messaging Runtime TransportEncoderProtocol(s)TransportEncoderProtocol(s) Client Dispatcher Service Contract and Behaviors Binding Address

15 Every service is associated with a unique address. 15 Microsoft Innovation & Practice Team, MSCoE Location of the Service Transport protocol used in service Address of the Service

16 Address  WCF supports following Transport  16 Microsoft Innovation & Practice Team, MSCoE HTTP http://localhost:8001/Dell http://localhost/Dell TCP net.tcp://localhost:800/Dell net.tcp://localhost/Dell MSMQ net.msmq/private/MyService Net.msmq/://localhost/Dell IPC net.pipe://localhost/MyPipe Peer network Net.pipe://localhost.MyService

17 Binding Describes how a service communicates Specifies set of binding elements Transport; http, tcp, np, msmq Encoding format; text, binary, MTOM,... Security requirements Reliable session requirements Transaction requirements Set of predefined standard bindings Can be customized Custom binding 17 Microsoft Innovation & Practice Team, MSCoE

18 Bindings & Binding Elements Transport IPCMSMQ Custom TCPHTTP Protocol Encoders.NETTX Custom SecurityReliability Binding HTTPTXSecurityReliabilityText Binary Custom

19 Binding Microsoft Innovation & Practice Team, MSCoE 19 Binding Name as of classTransportEncodingInte rop erab le BasicHttpBindingHTTP/HTTPSText,MTOMYes NetTcpBindingTCPBinaryNo NetPeerBindingP2PBinaryNo NetNamedPipeBindingIPCBinaryNo WSHttpBindingHTTP/HTTPSText,MTOMYes WSFederationHttpBindingHTTP/HTTPSText,MTOMYes WSDualHttpBindingHTTPText,MTOMYes NetMsmqBindingMSMQBinaryNo MsmqIntegrationBindingMSMQBinaryYes

20 ASMX/WSE3WCF WCF ASMX/WSE3 Choosing BindingsMSMQWCF WCF MSMQ WS-* Protocols MSMQ Protocol MSMQ Binding Http/WS Binding Other Platform WCF WCF WS-* Protocols Http/WS Binding WCFWCF Any Protocol Any Binding

21 Configuring Bindings

22 Contracts  WCF services exposes contract.  This is a platform neutral and standard   This says, what a service will do.  Defines, what a Service communicate 22 Microsoft Innovation & Practice Team, MSCoE

23 Types of Contracts 23 Microsoft Innovation & Practice Team, MSCoE Service Contract Describes which operation client can perform on the services. Data Contract Defines which Data Type are passed to and from the services. It provides built-in contract for implicit type. Fault Contract Which error raise by service and how service propagates and handles error to its client. Message Contract Allow the service to interact directly with tche message. Message contract can be typed or un typed. This can be used for interoperability.

24 Service Contracts Describes what a service does Maps CLR types to WSDL [ServiceContract] defines the service contract [OperationContract] specifies operations One-way, request-reply, duplex MEPs, Sessions, Faults

25 A Service Contract

26 Data Contract Defines data structures Maps CLR types to XML Schema [DataContract] specifies types [DataMember] specifies members Can be applied to private fields!

27 A Data Contract

28 Message Contract [MessageContract] public class ComplexProblem { [MessageHeader] public string operation; [MessageBody] public ComplexNumber n1; [MessageBody] public ComplexNumber n2; [MessageBody] public ComplexNumber solution; // Constructors… }

29 End Points Each service must expose at least one business endpoint. Each End point has exactly one contract. All endpoint on service have a unique addresses. A single service can expose multiple end points. Multiple exposed endpoint for single service can use same or different Bindings. Multiple exposed endpoint for single service can use same or different Contracts. There is no relationship in between various endpoint service provides. 29

30 Defining Endpoints <endpoint address="Calculator" bindingSectionName="basicProfileBinding" contractType="ICalculator" />

31 Hosting  WCF services can not exist in void.  It must be hosted.  WCF services are hosted in windows process called host process.  A single host process can host multiple service.  A same service can be hosted in multiple host process. 31 Microsoft Innovation & Practice Team, MSCoE Host can be provided by IIS Developer as part of application Windows activation service

32 Message patterns 32

33 WCF Programming Model 33

34 Steps in creating WCF Service 34 Defining.Net service interface to serve as the Service contract Implement Service Contract in.Net class as Service type and configure its behavior Configure the End Point where service will expose, by specifying A,B,C Host Service type in application using WCF hosting infrastructure At client side,By using description of target End Point create PROXY. And write code against this Proxy.

35 WCF basic task cycle 1. Defining Service Contract 2. Implem enting Service Contract 3. Configur ing Services 4. Hosting Services 5. Building Clients 35

36 Thank You 36


Download ppt "Dhananjay Kumar MVP-Connected System 1. WCF  Agenda What is WCF ? Why WCF? Address, Binding, Contract End Points Hosting Message Patterns Programming."

Similar presentations


Ads by Google