SlideShare une entreprise Scribd logo
1  sur  61
 
The Windows Communication Foundation
[object Object],[object Object],[object Object],The Connectivity Imperative
.NET At The Core
Windows Communication Foundation The Unified Framework For Rapidly Building  Service-Oriented Applications
Windows Communication Foundation INTEROPERABILITY PRODUCTIVITY SERVICE-ORIENTED DEVELOPMENT ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Unified Programming Model Interop with other platforms ASMX Attribute-  Based Programming Enterprise Services WS-* Protocol Support WSE Message- Oriented Programming System.Messaging Extensibility Location transparency .NET Remoting
WS-* Protocol Support XML Messaging Security Transactions Reliable Messaging Metadata
Investment Protection SIDE-BY-SIDE Interop UPGRADE
SERVICE ORIENTATION
From Objects to Services ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Object-Oriented Service-Oriented Component-Oriented 1980s 2000s 1990s
Four Tenets of Service Orientation SERVICE ORIENTATION Compatibility Based On Policy Share Schema & Contract, Not Class Services Are Autonomous Boundaries Are Explicit
Conventional Web Services ,[object Object],.NET Component ASMX Web Service HTTP Client
WCF Services ,[object Object],.NET Component HTTP Host TCP Host ICP Host MSMQ Host HTTP Client TCP Client ICP Client MSMQ Client Service Contract
The Windows Communication Foundation
Main Design Goal ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Callers and Services Caller Service
Endpoints Caller Service Endpoint Endpoint Endpoint Endpoint
Address, Binding, Contract Service Caller C B A C B A A B C Address Where? Contract What? Binding How? C B A
Creating Endpoints Service Service Host Caller Proxy or ChannelFactory A B C C B A C B A C B A
Exposing & Configuring Endpoints proxy.cs Caller app/web.config GetMetadata WSDL Service ? C B A C B A C B A C B A C B A C B A
Hello World
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
WCF Contracts Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Service Contract [ServiceContract] public interface ICalculator { [OperationContract] int DoMath(int a, int b, string op); }
Service Contract An Opt-In Model [ServiceContract] public interface ICalculator { [OperationContract] int DoMath(int a, int b, string op); // Not exposed as part of the external contract :-) void MethodRequiredForImplementation(bool b); }
Operations Types Message  DoXmlMath( Message  m); Untyped (“Universal”) MathResponse  DoMsgMath( MathRequest  msg); int  DoParamsMath( int a, int b, string op ); Typed Message Parameterized Operations (shorthand for TM)
Service Contract: Names [ServiceContract( Namespace ="http://TechEd.WCF.Intro")] public interface IGreetings { [OperationContract(  Name =“SayHello", Action ="http://TechEd.WCF.Intro/HelloRequest", ReplyAction ="http://TechEd.WCF.Intro/HelloResponse")] string Greet(string name); [OperationContractAttribute( Action = "*" )] void UnrecognizedMessageHandler( Message msg ); } class GreetingService : IGreetings { public string Greet(string name) { return “Hello, " + name; } public void UnrecognizedMessageHandler(Message msg) { Console.WriteLine("Unrecognized message: " + msg.ToString()); } }
Modeling Request/Reply Operations ,[object Object],[object Object],[object Object],[object Object],[object Object],[OperationContract] MathResponse DoMsgMath(MathRequest msg); [OperationContrac t(AsyncPattern=true) ] IAsyncResult BeginDoMsgMath(MathRequest msg,  AsyncCallback cb, object state ) ; MathResponse EndDoMsgMath(IAsyncResult call);
Service Contract: OneWay [ServiceContract] public interface IOneWayCalculator { [OperationContract( IsOneWay=true )] void DoMath(MathRequest request); }
Service Contract: Duplex [ServiceContract(SessionMode=SessionMode.Required,  CallbackContract=typeof(ICalculator Results ) ] public interface ICalculatorProblems { [OperationContract(IsOneWay=true)] void DoMath(MathRequest request); } public interface ICalculatorResults { [OperationContract(IsOneWay=true)] void DisplayResults(MathResponse response); }
Service Contract: Faults t ry { return n1 / n2; } catch (DivideByZeroException e)   { MyMathFault f = new MyMathFault (n1, n2); FaultReason r = new FaultReason(&quot;Divide By Zero&quot;); throw new Fault Exception < MyMathFault >( f, r ); } [ServiceContract(Session=true)] public interface ICalculator { [OperationContract] [FaultContract(typeof( MyMathFault ))] int DoMath(int a, int b, string op); }
Service Contract: Versioning [ServiceContract] public interface  ICalculator2 : ICalculator { [OperationContract(IsOneWay=true)] void SolveAndStoreProblem (ComplexProblem p); }
Service Contract: Streams [ServiceContract ] public interface IStreamCalculator { [OperationContract] Stream  Fibonacci(int iterations); }
Data Contract [DataContract] public enum Position { [ EnumMember ] Employee, [ EnumMember ] Manager, [ EnumMember( Value =  “ Vendor&quot; ) ] Contractor, NotASerializableEnumeration }
Data Contract: Names [DataContract( Name=“Complex”,   Namespace=“http://BigMath.Samples” )] public class ComplexNumber { [DataMember( Name=“RealPart” )]    public double Real = 0.0D;   [DataMember( Name=“ImaginaryPart” )]   public double Imaginary = 0.0D;   public ComplexNumber(double r, double i)   {   this.Real = r;   this.Imaginary = i;   } }
Data Contract: Enumerations [DataContract] public enum Position { [EnumMember] Employee, [EnumMember] Manager, [EnumMember(Value = “Vendor&quot;)] Contractor, NotASerializableEnumeration }
Message Contract [MessageContract] public class ComplexProblem { [MessageHeader(Name=&quot;Op&quot;, MustUnderstand=true)]    public string operation; [MessageBodyMember]   public ComplexNumber n1; [MessageBodyMember]   public ComplexNumber n2; [MessageBodyMember]   public ComplexNumber solution;   // Constructors… }
Mapping Contracts (1/2) [ MessageContract ] public class MyRequest { [MessageHeader]  public int Amount; [MessageBody]   public ItemInfo Info; } [ DataContract ] public class ItemInfo { [DataMember]  public int ID; [DataMember]  public double Cost; [DataMember]  public string Name; } wsdl:message wsdl:part xsd:element
Mapping Contracts (2/2) [ ServiceContract ] public interface MyContract { [OperationContract]   MyReply MyOp(MyRequest request); [OperationContract]   void MyOp2(MyRequest2 request); } wsdl:portType wsdl:operation
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Bindings & Binding Elements Transport IPC MSMQ Custom TCP HTTP Protocol Encoders .NET TX Custom Security Reliability Binding HTTP TX Security Reliability Text Text Binary Custom TCP Binary
Binding Element Features ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
System-Provided Bindings N = None | T = Transport | M = Message | B = Both | RS = Reliable Sessions Binding  Interop Security Session TX Duplex  BasicHttpBinding  BP 1.1 N, T N N n/a WSHttpBinding  WS M , T, X N , T, RS N , Yes n/a WSDualHttpBinding  WS M RS N , Yes Yes WSFederationBinding  Federation M N , RS N , Yes No NetTcpBinding  .NET T , M T  ,RS N , Yes Yes NetNamedPipeBinding  .NET T T , N N , Yes Yes NetPeerTcpBinding  Peer T N N Yes NetMsmqBinding  .NET T , M, X N N , Yes No MsmqIntegrationBinding  MSMQ T N N , Yes n/a
Binding in Config <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <system.serviceModel> <services> <service serviceType=&quot;CalculatorService&quot;> <endpoint address=&quot;Calculator&quot; bindingSectionName=&quot;basicProfileBinding&quot; contractType=&quot;ICalculator&quot; /> </service> </services> </system.serviceModel> </configuration>
Configuring Bindings <endpoint address=&quot;Calculator&quot;   bindingSectionName=&quot; basic Http Binding &quot;   bindingConfiguration=&quot; UsernameBinding &quot;   contractType=&quot;ICalculator&quot; /> <bindings>   <basicHttpBinding> <binding name=&quot; UsernameBinding &quot;  messageEncoding=&quot;Mtom&quot;> <security mode=&quot;Message&quot;> <message clientCredentialType=&quot;UserName&quot;/> </security> </binding> </basicHttpBinding> < /bindings>
Custom Bindings <bindings> <customBinding> <customBinding> <binding name=&quot;ReliableTCP&quot;> <reliableSession   inactivityTimeout=&quot;0:0:5“ ordered=&quot;true&quot;/> <binaryMessageEncoding/> <tcpTransport transferMode=&quot;Buffered&quot;/> </binding> </customBinding> </customBinding> </bindings>
Choosing Bindings Any Protocol Any Binding Any Binding WCF WCF MSMQ WCF COM+/ES WCF MSMQ Protocol WS-* Protocols MSMQ Binding Moniker ASMX/WSE3 WCF WS-* Protocols Http/WS Binding Other Platform WCF WS-* Protocols Http/WS Binding
Interaction of Bindings and Code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Behaviors Client-Side  Behaviors Service-Side Behaviors Service Caller Be Be C B A C B A A B C C B A
Behaviors: Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example: Security Service Client Be Be Bindings Move Claims in Messages Behaviors Implement Security Gates Behaviors Provide Credentials C B A C B A A B C C B A
Example: Transactions Service Caller Be Bindings Flow Transactions Behaviors AutoEnlist and AutoComplete C B A C B A A B C C B A
Anti-Example: Reliable Sessions Service Caller Bindings provide Session and Guarantees C B A C B A A B C C B A
Behavior Features ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Features Summary Address Binding Behavior Contract HTTP Transport TCP Transport NamedPipe Transport MSMQ Transport Custom Transport WS-Security Protocol WS-RM Protocol WS-AT Protocol Duplex Channel Custom Protocol http://... net.tcp://... net.pipe://... net.msmq://... xxx://... Throttling Behavior Metadata Behavior Error  Behavior Custom Behavior Instancing Behavior Concurrency Behavior Transaction Behavior Security Behavior Request/ Response One-Way Duplex net.p2p://... Peer Transport Externally visible, per-endpoint Opaque, per-service, endpoint, or op
WCF Application “Architecture” Channels Transport Channels   (IPC, HTTP, TCP…) Reliability Message  Encoder Security Hosting Environments WAS IIS .exe Windows Service DllHost Messaging Services Queuing Routing Eventing Discovery Service Model Application Instance  Manager Context  Manager Type Integration Service Methods Declarative Behaviors Transacted Methods
Presentation Takeaways ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 

Contenu connexe

Tendances

Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Saltmarch Media
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Peter R. Egli
 
Wcf architecture overview
Wcf architecture overviewWcf architecture overview
Wcf architecture overviewArbind Tiwari
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCFybbest
 
Windows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceWindows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceSj Lim
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Storyukdpe
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487Bat Programmer
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Jason Townsend, MBA
 
Web services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsWeb services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsPeter Gfader
 
Web services
Web servicesWeb services
Web servicesaspnet123
 
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Jorgen Thelin
 
Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Martin Necasky
 

Tendances (20)

Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
Wcf architecture overview
Wcf architecture overviewWcf architecture overview
Wcf architecture overview
 
WCF Fundamentals
WCF Fundamentals WCF Fundamentals
WCF Fundamentals
 
WCF Introduction
WCF IntroductionWCF Introduction
WCF Introduction
 
WCF
WCFWCF
WCF
 
WCF
WCFWCF
WCF
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCF
 
WCF for begineers
WCF  for begineersWCF  for begineers
WCF for begineers
 
Windows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best PracticesWindows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best Practices
 
Windows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceWindows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) Service
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Story
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487
 
Wcf
Wcf Wcf
Wcf
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003
 
Web services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsWeb services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows Forms
 
Web services
Web servicesWeb services
Web services
 
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
 
Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)
 

En vedette

MSMQ - Microsoft Message Queueing
MSMQ - Microsoft Message QueueingMSMQ - Microsoft Message Queueing
MSMQ - Microsoft Message QueueingPeter R. Egli
 
Message Oriented Middleware (MOM)
Message Oriented Middleware (MOM)Message Oriented Middleware (MOM)
Message Oriented Middleware (MOM)drewenut
 
Message Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBusMessage Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBusLars-Erik Kindblad
 
Architecture of message oriented middleware
Architecture of message oriented middlewareArchitecture of message oriented middleware
Architecture of message oriented middlewareLikan Patra
 
Middleware and Middleware in distributed application
Middleware and Middleware in distributed applicationMiddleware and Middleware in distributed application
Middleware and Middleware in distributed applicationRishikese MR
 
MOM - Message Oriented Middleware
MOM - Message Oriented MiddlewareMOM - Message Oriented Middleware
MOM - Message Oriented MiddlewarePeter R. Egli
 
Unit 1 architecture of distributed systems
Unit 1 architecture of distributed systemsUnit 1 architecture of distributed systems
Unit 1 architecture of distributed systemskaran2190
 

En vedette (9)

Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
 
Message oriented middleware
Message oriented middlewareMessage oriented middleware
Message oriented middleware
 
MSMQ - Microsoft Message Queueing
MSMQ - Microsoft Message QueueingMSMQ - Microsoft Message Queueing
MSMQ - Microsoft Message Queueing
 
Message Oriented Middleware (MOM)
Message Oriented Middleware (MOM)Message Oriented Middleware (MOM)
Message Oriented Middleware (MOM)
 
Message Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBusMessage Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBus
 
Architecture of message oriented middleware
Architecture of message oriented middlewareArchitecture of message oriented middleware
Architecture of message oriented middleware
 
Middleware and Middleware in distributed application
Middleware and Middleware in distributed applicationMiddleware and Middleware in distributed application
Middleware and Middleware in distributed application
 
MOM - Message Oriented Middleware
MOM - Message Oriented MiddlewareMOM - Message Oriented Middleware
MOM - Message Oriented Middleware
 
Unit 1 architecture of distributed systems
Unit 1 architecture of distributed systemsUnit 1 architecture of distributed systems
Unit 1 architecture of distributed systems
 

Similaire à introduction to Windows Comunication Foundation

A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & RESTSanthu Rao
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorialAbhi Arya
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaJignesh Aakoliya
 
Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Abdul Khan
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questionstongdang
 
WCF and WF in Framework 3.5
WCF and WF in Framework 3.5WCF and WF in Framework 3.5
WCF and WF in Framework 3.5ukdpe
 
WINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATIONWINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATIONDeepika Chaudhary
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its SecurityMindfire Solutions
 
Interoperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITInteroperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITCarol McDonald
 
Bee brief-intro-q42016
Bee brief-intro-q42016Bee brief-intro-q42016
Bee brief-intro-q42016wahyu prayudo
 
Introduction To Dot Net Siddhesh
Introduction To Dot Net SiddheshIntroduction To Dot Net Siddhesh
Introduction To Dot Net SiddheshSiddhesh Bhobe
 
Consul: Service Mesh for Microservices
Consul: Service Mesh for MicroservicesConsul: Service Mesh for Microservices
Consul: Service Mesh for MicroservicesArmonDadgar
 
Wcf best practice
Wcf best practiceWcf best practice
Wcf best practiceYu GUAN
 
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Jason Townsend, MBA
 

Similaire à introduction to Windows Comunication Foundation (20)

A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & REST
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
 
07 advanced topics
07 advanced topics07 advanced topics
07 advanced topics
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
 
Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...
 
Wcf faq
Wcf faqWcf faq
Wcf faq
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questions
 
WCF 4 Overview
WCF 4 OverviewWCF 4 Overview
WCF 4 Overview
 
WCF and WF in Framework 3.5
WCF and WF in Framework 3.5WCF and WF in Framework 3.5
WCF and WF in Framework 3.5
 
WINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATIONWINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATION
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its Security
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
Web services
Web servicesWeb services
Web services
 
Interoperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITInteroperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSIT
 
Bee brief-intro-q42016
Bee brief-intro-q42016Bee brief-intro-q42016
Bee brief-intro-q42016
 
Introduction To Dot Net Siddhesh
Introduction To Dot Net SiddheshIntroduction To Dot Net Siddhesh
Introduction To Dot Net Siddhesh
 
Consul: Service Mesh for Microservices
Consul: Service Mesh for MicroservicesConsul: Service Mesh for Microservices
Consul: Service Mesh for Microservices
 
SOA and web services
SOA and web servicesSOA and web services
SOA and web services
 
Wcf best practice
Wcf best practiceWcf best practice
Wcf best practice
 
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 

Dernier (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

introduction to Windows Comunication Foundation

  • 1.  
  • 3.
  • 4. .NET At The Core
  • 5. Windows Communication Foundation The Unified Framework For Rapidly Building Service-Oriented Applications
  • 6.
  • 7. Unified Programming Model Interop with other platforms ASMX Attribute- Based Programming Enterprise Services WS-* Protocol Support WSE Message- Oriented Programming System.Messaging Extensibility Location transparency .NET Remoting
  • 8. WS-* Protocol Support XML Messaging Security Transactions Reliable Messaging Metadata
  • 11.
  • 12. Four Tenets of Service Orientation SERVICE ORIENTATION Compatibility Based On Policy Share Schema & Contract, Not Class Services Are Autonomous Boundaries Are Explicit
  • 13.
  • 14.
  • 16.
  • 17.
  • 18. Callers and Services Caller Service
  • 19. Endpoints Caller Service Endpoint Endpoint Endpoint Endpoint
  • 20. Address, Binding, Contract Service Caller C B A C B A A B C Address Where? Contract What? Binding How? C B A
  • 21. Creating Endpoints Service Service Host Caller Proxy or ChannelFactory A B C C B A C B A C B A
  • 22. Exposing & Configuring Endpoints proxy.cs Caller app/web.config GetMetadata WSDL Service ? C B A C B A C B A C B A C B A C B A
  • 24.
  • 25.
  • 26. Service Contract [ServiceContract] public interface ICalculator { [OperationContract] int DoMath(int a, int b, string op); }
  • 27. Service Contract An Opt-In Model [ServiceContract] public interface ICalculator { [OperationContract] int DoMath(int a, int b, string op); // Not exposed as part of the external contract :-) void MethodRequiredForImplementation(bool b); }
  • 28. Operations Types Message DoXmlMath( Message m); Untyped (“Universal”) MathResponse DoMsgMath( MathRequest msg); int DoParamsMath( int a, int b, string op ); Typed Message Parameterized Operations (shorthand for TM)
  • 29. Service Contract: Names [ServiceContract( Namespace =&quot;http://TechEd.WCF.Intro&quot;)] public interface IGreetings { [OperationContract( Name =“SayHello&quot;, Action =&quot;http://TechEd.WCF.Intro/HelloRequest&quot;, ReplyAction =&quot;http://TechEd.WCF.Intro/HelloResponse&quot;)] string Greet(string name); [OperationContractAttribute( Action = &quot;*&quot; )] void UnrecognizedMessageHandler( Message msg ); } class GreetingService : IGreetings { public string Greet(string name) { return “Hello, &quot; + name; } public void UnrecognizedMessageHandler(Message msg) { Console.WriteLine(&quot;Unrecognized message: &quot; + msg.ToString()); } }
  • 30.
  • 31. Service Contract: OneWay [ServiceContract] public interface IOneWayCalculator { [OperationContract( IsOneWay=true )] void DoMath(MathRequest request); }
  • 32. Service Contract: Duplex [ServiceContract(SessionMode=SessionMode.Required, CallbackContract=typeof(ICalculator Results ) ] public interface ICalculatorProblems { [OperationContract(IsOneWay=true)] void DoMath(MathRequest request); } public interface ICalculatorResults { [OperationContract(IsOneWay=true)] void DisplayResults(MathResponse response); }
  • 33. Service Contract: Faults t ry { return n1 / n2; } catch (DivideByZeroException e) { MyMathFault f = new MyMathFault (n1, n2); FaultReason r = new FaultReason(&quot;Divide By Zero&quot;); throw new Fault Exception < MyMathFault >( f, r ); } [ServiceContract(Session=true)] public interface ICalculator { [OperationContract] [FaultContract(typeof( MyMathFault ))] int DoMath(int a, int b, string op); }
  • 34. Service Contract: Versioning [ServiceContract] public interface ICalculator2 : ICalculator { [OperationContract(IsOneWay=true)] void SolveAndStoreProblem (ComplexProblem p); }
  • 35. Service Contract: Streams [ServiceContract ] public interface IStreamCalculator { [OperationContract] Stream Fibonacci(int iterations); }
  • 36. Data Contract [DataContract] public enum Position { [ EnumMember ] Employee, [ EnumMember ] Manager, [ EnumMember( Value = “ Vendor&quot; ) ] Contractor, NotASerializableEnumeration }
  • 37. Data Contract: Names [DataContract( Name=“Complex”, Namespace=“http://BigMath.Samples” )] public class ComplexNumber { [DataMember( Name=“RealPart” )] public double Real = 0.0D; [DataMember( Name=“ImaginaryPart” )] public double Imaginary = 0.0D; public ComplexNumber(double r, double i) { this.Real = r; this.Imaginary = i; } }
  • 38. Data Contract: Enumerations [DataContract] public enum Position { [EnumMember] Employee, [EnumMember] Manager, [EnumMember(Value = “Vendor&quot;)] Contractor, NotASerializableEnumeration }
  • 39. Message Contract [MessageContract] public class ComplexProblem { [MessageHeader(Name=&quot;Op&quot;, MustUnderstand=true)] public string operation; [MessageBodyMember] public ComplexNumber n1; [MessageBodyMember] public ComplexNumber n2; [MessageBodyMember] public ComplexNumber solution; // Constructors… }
  • 40. Mapping Contracts (1/2) [ MessageContract ] public class MyRequest { [MessageHeader] public int Amount; [MessageBody] public ItemInfo Info; } [ DataContract ] public class ItemInfo { [DataMember] public int ID; [DataMember] public double Cost; [DataMember] public string Name; } wsdl:message wsdl:part xsd:element
  • 41. Mapping Contracts (2/2) [ ServiceContract ] public interface MyContract { [OperationContract] MyReply MyOp(MyRequest request); [OperationContract] void MyOp2(MyRequest2 request); } wsdl:portType wsdl:operation
  • 42.
  • 43. Bindings & Binding Elements Transport IPC MSMQ Custom TCP HTTP Protocol Encoders .NET TX Custom Security Reliability Binding HTTP TX Security Reliability Text Text Binary Custom TCP Binary
  • 44.
  • 45. System-Provided Bindings N = None | T = Transport | M = Message | B = Both | RS = Reliable Sessions Binding Interop Security Session TX Duplex BasicHttpBinding BP 1.1 N, T N N n/a WSHttpBinding WS M , T, X N , T, RS N , Yes n/a WSDualHttpBinding WS M RS N , Yes Yes WSFederationBinding Federation M N , RS N , Yes No NetTcpBinding .NET T , M T ,RS N , Yes Yes NetNamedPipeBinding .NET T T , N N , Yes Yes NetPeerTcpBinding Peer T N N Yes NetMsmqBinding .NET T , M, X N N , Yes No MsmqIntegrationBinding MSMQ T N N , Yes n/a
  • 46. Binding in Config <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <system.serviceModel> <services> <service serviceType=&quot;CalculatorService&quot;> <endpoint address=&quot;Calculator&quot; bindingSectionName=&quot;basicProfileBinding&quot; contractType=&quot;ICalculator&quot; /> </service> </services> </system.serviceModel> </configuration>
  • 47. Configuring Bindings <endpoint address=&quot;Calculator&quot; bindingSectionName=&quot; basic Http Binding &quot; bindingConfiguration=&quot; UsernameBinding &quot; contractType=&quot;ICalculator&quot; /> <bindings> <basicHttpBinding> <binding name=&quot; UsernameBinding &quot; messageEncoding=&quot;Mtom&quot;> <security mode=&quot;Message&quot;> <message clientCredentialType=&quot;UserName&quot;/> </security> </binding> </basicHttpBinding> < /bindings>
  • 48. Custom Bindings <bindings> <customBinding> <customBinding> <binding name=&quot;ReliableTCP&quot;> <reliableSession inactivityTimeout=&quot;0:0:5“ ordered=&quot;true&quot;/> <binaryMessageEncoding/> <tcpTransport transferMode=&quot;Buffered&quot;/> </binding> </customBinding> </customBinding> </bindings>
  • 49. Choosing Bindings Any Protocol Any Binding Any Binding WCF WCF MSMQ WCF COM+/ES WCF MSMQ Protocol WS-* Protocols MSMQ Binding Moniker ASMX/WSE3 WCF WS-* Protocols Http/WS Binding Other Platform WCF WS-* Protocols Http/WS Binding
  • 50.
  • 51.
  • 52. Behaviors Client-Side Behaviors Service-Side Behaviors Service Caller Be Be C B A C B A A B C C B A
  • 53.
  • 54. Example: Security Service Client Be Be Bindings Move Claims in Messages Behaviors Implement Security Gates Behaviors Provide Credentials C B A C B A A B C C B A
  • 55. Example: Transactions Service Caller Be Bindings Flow Transactions Behaviors AutoEnlist and AutoComplete C B A C B A A B C C B A
  • 56. Anti-Example: Reliable Sessions Service Caller Bindings provide Session and Guarantees C B A C B A A B C C B A
  • 57.
  • 58. Features Summary Address Binding Behavior Contract HTTP Transport TCP Transport NamedPipe Transport MSMQ Transport Custom Transport WS-Security Protocol WS-RM Protocol WS-AT Protocol Duplex Channel Custom Protocol http://... net.tcp://... net.pipe://... net.msmq://... xxx://... Throttling Behavior Metadata Behavior Error Behavior Custom Behavior Instancing Behavior Concurrency Behavior Transaction Behavior Security Behavior Request/ Response One-Way Duplex net.p2p://... Peer Transport Externally visible, per-endpoint Opaque, per-service, endpoint, or op
  • 59. WCF Application “Architecture” Channels Transport Channels (IPC, HTTP, TCP…) Reliability Message Encoder Security Hosting Environments WAS IIS .exe Windows Service DllHost Messaging Services Queuing Routing Eventing Discovery Service Model Application Instance Manager Context Manager Type Integration Service Methods Declarative Behaviors Transacted Methods
  • 60.
  • 61.