Mahesh Krishnan, Senior Consultant, Readify Slide 1.

Slides:



Advertisements
Similar presentations
Indigo Jonathan Turnbull Nick Cartwright Ivan Konontsev Chris Bright.
Advertisements

Michael S. Chan xLM Solutions, LLC
WCF Intro Scott Reed Owner - Brain Hz Software Instructor – DevelopMentor
SOAP.
 Introduction  WCF Definition  WCF Architecture  Implementation  WCF Demo Overview.
1 Nordjyllands Erhvervakademi Windows Communication Foundation Introduction –.Net foundations –Communication Protocols –SOA tenets WCF –Basics –Contracts.
Windows Communication Foundation and Web Services.
Copyright © 2007 CA. All trademarks, trade names, services marks and logos referenced herein belong to their respective companies. 5C The Plex SOA Strategy.
Darryl Burling Developer Evangelist Microsoft The age of connected applications Whats new in VS2008 WCF Background: WS*,.Net 3.0 and WCF ABC’s & improvments.
X.509 support in WCF Exploring support for X.509 Certificates in Microsoft’s Windows Communication Foundation Paul Cormier UCCS CS591 Fall 2009.
Adam Dille CS526 – Spring  Advances in Microsoft’s service offerings  ASMX vs. WCF  Latest WCF Improvements (.NET 4.0)  No in-depth study of.
The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd
Web Services (ASMX 2.0 and WSE 3.0) Mike Taulty Developer & Platform Group Microsoft Ltd
Module 13: WCF Receive Adapters. Overview Lesson 1: Introduction to WCF Receive Adapters Lesson 2: Configuring a WCF Receive Adapter Lesson 3: Using the.
Getting Started with Windows Communication Foundation 4.5 Ed Jones, MCT, MCPD, MCTS Consultant RBA Inc.
WCF Services in Nutshell A Tutorial using WCF Mr. Michael Arnwine WCF using Service Oriented Architecture (SOA) and “Restful” Service.
Getting Started with WCF Windows Communication Foundation 4.0 Development Chapter 1.
Nikola Dudar Program Manager Microsoft Corporation Session Code: DTL 311.
Bruno Terkaly | Technical Evangelist Bret Stateham | Technical Evangelist.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Introduction to Windows Communication Foundation Ruwan Wijesinghe.
[Title of the course] WCF
Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts How to host WCF services.
1 Windows Communication Foundation: Integrating COM+ and MSMQ Applications Andy Milligan COM305 Program Manager Microsoft Corporation.
Microsoft Visual Studio 2010 Muhammad Zubair MS (FAST-NU) Experience: 5+ Years Contact:- Cell#:
Brian Noyes Chief Architect IDesign Inc ( Session Code: SOA 305.
Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,
1 UCN 2012 Why use distributed (client / server) applications? To connect tiers within the same application... –client & server is both.NET assemblies.
Microsoft Visual Studio 2010 Muhammad Zubair MS (FAST-NU) Experience: 5+ Years Contact:- Cell#:
Intro to WCF From the beginning and uses Steve AppRochester.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Random Logic l Forum.NET l Web Services Enhancements for Microsoft.NET (WSE) Forum.NET ● October 4th, 2006.
A Deep Dive into Best Practices with the Windows Communication Foundation John Justice COM415 Program Manager Microsoft Corporation.
Developing Web Services Using ASP.NET and WSE That Interoperate with the Windows Communications Foundation ("Indigo") Mark Fussell COM432 Lead Program.
Telerik Software Academy Web Services & Cloud.
Introducing the ABCs of Windows Communication Foundation | Feb 2006 rickgaribay.net Windows Communication Foundation Hosting & Endpoints Winter 2006.
2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand SOA315.
Web Services Error Handling and Debugging. Agenda Simple SOAP faults Advanced SOAP faults SOAP headers and faults Error handling From a Service Perspective.
Windows Communication Foundation David Anderson Independent Software Developer DCOM Productions.
Presentation 24: Windows Communication Foundation Introduced Objektorienteret Netværkskommunikation.
Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts How to host WCF services.
Slide 1. Agenda  Introduction to Windows Workflow What is it? What are activities? Hosting  Out of the box Activities  Custom Activities and Dependency.
Dhananjay Kumar MVP-Connected System 1. WCF  Agenda What is WCF ? Why WCF? Address, Binding, Contract End Points Hosting Message Patterns Programming.
Christian Weyer thinktecture.
Introduction to.NET FX 3.0 (+ sneak preview of.NET FX 3.5) Martin Parry Developer & Platform Group Microsoft Ltd
The SOAP Story Martin Parry Developer & Platform Group Microsoft Ltd
Windows Communication Foundation António Cruz Freelancer (SAPO/PT.COM)
Shani Raba Team Leader & Software Architect
OE-NIK HP Advanced Programming WCF WCF SOAP service, host, client Exception handling (NOT required)
Windows Communication Foundation Stipe Ivan Latković.
Nati Dobkin
O VERVIEW OF SOA AND WCF Jinaldesai.net – My Thouths And Learnings.
Windows Communication Foundation. Agenda How We Got Here ASMX vs WCF Throwdown WCF Contracts Service Data Message Bindings Security Reliability Declarative.
Windows Communication Foundation Part 1 You can reuse these slides but please mention the original source if you want to do so. Speaker: Nguyễn Bá Quang.
Windows Communication Foundation and Web Services
Jim Fawcett CSE681 – SW Modeling & Analysis Spring 2005
Windows Communication Foundation
Segments Introduction: slides 2–7 10 minutes
4/12/2018 2:37 PM Windows Communication Foundation: Migration, interop, upgrade, and integration Risman Adnan ISV Lead, Microsoft Indonesia
Windows Communication Foundation
Windows Communication Foundation
Window Communication Foundation
WCF.
Windows Communication Foundation
Windows Communication Foundation (WCF)
Distribution of functionality Webservice using WCF
Windows Communication Foundation and Web Services
Windows Communication Foundation
Windows Communication Foundation (WCF)
Distributed Applications on Windows Vista
The SOAP Story Martin Parry Developer & Platform Group Microsoft Ltd
Presentation transcript:

Mahesh Krishnan, Senior Consultant, Readify Slide 1

Agenda  Introduction to WCF What is it? Why use it? Fundamentals and the ABCs of WCF Hosting  Tooling Support  Passing data around in WCF  Handling faults

Slide 3

What is WCF?  Stands for Windows Communication Foundation  One of the 4 pillars of.NET 3.0  Microsoft’s unified programming model (the service model) for building Service-Oriented Applications

Windows Communication Foundation  WCF provides: an SDK for creating SOA a runtime for running Services on Windows  Services send and receive messages  All messages are SOAP messages  WCF takes care of all the plumbing Slide 5

Why use WCF?  Interoperable and Standards based Supports WS-* protocols  Unified Programming Model Unifies previous models like.NET Remoting, ASMX web services, COM+ etc  Productive Programming Model Declarative Imperative Configuration based Slide 6

WCF: How does it work?

WCF End points

Every service has  Address Where the service is  Binding How to talk to the service  Contract What the service can do Slide 9

The EndPoint Anology AddressBindingContract Slide 10

Address  Combination of transport, server name, port & path  Transport is determined by the binding  Examples net.tcp://localhost:8002/MyService net.pipe://localhost/MyPipe net.msmq://localhost/private/MyService net.msmq://localhost/MyService Slide 11

Bindings  Transport HTTP TCP MSMQ  Message formats and encoding Plain text Binary Message Transmission Optimization Mechanism (MTOM)  Communication security No security Transport security Message security Authenticating and authorizing callers Slide 12

Out of the box Bindings  BasicHttpBinding  WSHttpBinding  WS2007HttpBinding  WSDualHttpBinding  WSFederationHttp Binding  WS2007FederationHttp Binding  NetTcpBinding  NetNamedPipeBinding  NetMsmqBinding  NetPeerTcpBinding  WebHttpBinding  MsmqIntegrationBinding Slide 13

Contracts  Service contracts Defines operations, communications and behaviours.  Data contracts Defines data entities and parameter types.  Fault contracts Defines error types  Message contracts Defines message formats Slide 14

Service Contracts  [ServiceContract] – Defines a ‘set’ of operations  [OperationContract] – Defines a single method Slide 15 [ServiceContract] public interface IService { [OperationContract] string GetData(int value); } public class ConcreteService : IService { public string GetData(int value) {... } public string OtherMethod() {... } }

Data Contracts  [DataContract] – Specifies type as a data contract  [DataMember] – Members that are part of contract Slide 16 [DataContract] public class CustomType { [DataMember] public bool MyFlag { get; set; } [DataMember] public string MyString { get; set; } }

Metadata Exchange  Service can also expose endpoint for Metadata Exchange (MEX)  It provides a mechanism for clients to find out about: Address of other end points Bindings that are used Contracts used – Service, Operation, Data, etc Slide 17

Hosting  IIS HTTP only  WAS (Windows Activation Service) Can use any transport Vista and Windows Server 2008 only  Self hosting Can use any transport Can be hosted within Console, WinForms, etc Applications Slide 18

Slide 19

Tooling Support  Visual Studio Separate projects for WCF “Add Service reference” menu WCF Configuration Editor WCF Service Host WCF Test Tool  SvcUtil – To generate proxies  SvcTraceViewer – To view logs Slide 20

Demonstration Slide 21

Slide 22

Passing data around  To pass data across boundaries, they need to be serialized .NET Framework already contains an attribute for serialization Slide 23 [Serializable] public class Person { public string LastName; public string FirstName; }

Passing data around  Serializable Attribute has some limitations – Includes some type information in serialized data – not suited for true SOA Does not support aliases Does not support versioning Does not support ordering Explicit opt-out is needed to leave out some properties that shouldn’t be serialized Slide 24

Alternative – DataContract  DataContract: created specifically for WCF to serialize types Attribute contains Name and Namespace properties  DataMember is needed to specify which properties/fields will form part of the contract Contains EmitDefaultValue, IsRequired, Name, Order properties Slide 25

DataContract Slide 26 [DataContract(Name="Contact")] public class Person { [DataMember(IsRequired=true, Name="SurName")] public string LastName; public string FirstName; //Not included in contract }

Versioning of data contracts  Three different scenarios: New fields have been added Existing fields have been deleted Fields have been renamed Slide 27

Alternate way of looking at it:  Older version data [v1] passed to Service accepting newer version of data [v2]  Newer version data [v2] passed to Service accepting older version of data [v1]  New [v2]-> Old [v1]-> New [v2] Slide 28

New -> Old -> New Slide 29

Proxy code to hold Slide 30 [DataContract] public class MyDataContract : IExtensibleDataObject { public ExtensionDataObject ExtensionData { get; set; }

Inheritance with Data Contracts Slide 31 [DataContract] public class Employee {... } [DataContract] public class Manager : Employee {... } [ServiceContract] public interface IEmployeeService { [OperationContract] public void AddEmployee(Employee e); }

Inheritance with Data Contracts Slide 32 [DataContract] [KnownType(typeof(Manager))] public class Employee {... } [DataContract] public class Manager : Employee {... } [ServiceContract] public interface IEmployeeService { [OperationContract] public void AddEmployee(Employee e); }

Slide 33

SOAP Faults  Three main kinds of Exceptions can occur: Communication errors Unexpected error on the service Errors thrown by the service on purpose .NET Exceptions are technology specific  All Exceptions come across the wire as SOAP Faults Slide 34

Faults  In WCF, SOAP faults are passed in as FaultException objects  Rather than throwing Exceptions, services should throw FaultExceptions  Or better still FaultException  Throwing FaultExceptions will not fault the proxy and the channel Slide 35

FaultContracts  Specifies what kind of Exceptions, an operation can throw Slide 36 [ServiceContract] public interface IEmployeeService { [OperationContract] [FaultContract(typeof(ValidationException))] public void AddEmployee(Employee e); }

Server side code  Always throw Exceptions as Fault Exceptions Slide 37 public class EmployeeService { public void AddEmployee(Employee e) {... throw new FaultException (new ValidationException(errorMsg)); }

Client side code Slide 38 EmployeeServiceProxy proxy = new EmployeeServiceProxy(); try {... proxy.AddEmployee(emp); } catch(FaultException e) { //Do stuff with exception here } catch(FaultException e) { //Will catch all other types of Fault exceptions... }

Exceptions while developing Slide 39 <service name = "EmployeeService" behaviorConfiguration = "Debugging">... <serviceDebug includeExceptionDetailInFaults = "true"/>

Summary  WCF provides a runtime for creating Service Oriented Apps  Provides a productive programming model. Takes care of: Messaging and Exchange formats All Plumbing: Transaction, Reliability, Security, etc  Supports Declarative (via attributes), Imperative (via code) and Configuration based (via config files) programming model  ABCs of Endpoints Address: Where to go? Binding: How to get there? Contract: What to do?  Hosting IIS, WAS, Self-hosting

Summary (contd)  ServiceContract and OperationContract specify Service and operation information  DataContracts and DataMembers are used for specifying the data that is passed across the wire  Use KnownType attribute for specifying class hierarchy information in Data contracts  FaultContracts specify what Exceptions may be thrown by the operations

Slide 42