Slide1 : Mathias Olausson Solutions Architect, Callista Knowledgebase AB mo@callista.se http://olausson.net/blog/
A first look at Indigo aka. Windows Communication Foundation : A first look at Indigo aka. Windows Communication Foundation Introduction
Fundamentals
Programming WCF
Writing a simple WCF application
Callista Knowledgebase : Callista Knowledgebase Offers solutions on the Microsoft platform
Architecture and design
Training and mentoring
Development resources
Microsoft Partner
Certified Professionals
Certified Trainers
Part of the Callista network
http://knowledgebase.callista.se/
Slide4 : Introduction
What is WCF? : What is WCF? Unified programming model for building connected applications
Platform for advanced Web Services
Standards based
Building secure, reliable, transacted solutions
Scale-invariant
'Pay-as-you-go' model
Interoperability with existing investments
Integration across platforms
Client or server side component
Timeline : Timeline 2003
October PDC CTP
2005
March CTP
May Beta 1 RC
August Beta 1 (Windows Vista)
2006
Windows Vista = WCF v1
Supported platforms : Supported platforms Windows XP SP2
Windows Server 2003
Windows Vista
Windows Server 'Longhorn'
Requirements : Requirements .NET framework 2.0
WinFX beta1 andlt;-andgt; Visual Studio 2005 beta 2
IIS 5.1, 6.0, 7.0
Installed before WinFX
WinFX runtime
VS 2005 Extensions for WinFX
MSMQ 3.5 'Indigo' Beta 1 MSMQ Support Package
The 'Indigo' Beta 1 MSMQ Support Package is an update to MSMQ to allow developers using Windows XP and Windows Server 2003 to create applications that use the 'Indigo' queued channels feature.
COM+ Hotfix for 'Indigo'
This QFE package adds support for the WS-AtomicTransaction protocol to MSDTC and support for the 'Indigo' COM+ Integration feature.
Unified (superseded) technologies : Unified (superseded) technologies ASMX
Minor changes required
WSE 2.0
Migration to WSE 3.0 (Wire-compatible)
Currently in CTP release for VS 2005
.NET Remoting
Re-write, no upgrade path
Enterprise Services, COM+
Re-write or interoperability
MSMQ
Integration or interoperability
Interoperability : Interoperability Supports first and second generation web services
Interop with ES and MSMQ
Can act both as server and client
Interoperability – protocols : Interoperability – protocols HTTP1.1
MTOM
SOAP1.1
SOAP1.2
WSDL 1.1
WSS SOAP Message Security 1.0
WSS SOAP Message Security Username Token Profile 1.0
WSS SOAP Message Security X509 Token Profile 1.0
WSS SOAP Message Security Kerberos Token Profile 1.0
WS Addressing 2004/08
WS Atomic Transactions
WS Coordination
WS Metadata Exchange
WS Policy
WS Policy Attachments
WS Reliable Messaging
WS Secure Conversation
WS Transfer
WS Trust
Slide12 : Fundamentals
WCF Fundamentals : WCF Fundamentals Endpoints
Behavior
Runtime
Hosting
Configuration
Metadata
Diagnostics
Mappings to SOA
Endpoints : Endpoints The unit of communication
The ABC of WCF
Address – where to expose
Binding – how to expose
Contract – what to expose
Defined in code or in configuration
Use configuration wisely
Address : Address Defines where a service is located
Specifies a URI where the service is located
Relative or absolute
Address concist of
Scheme
HTTP, TCP, Named pipes, MSMQ
Machine
[Port]
Path
Examples
http://www.mystore.com/StoreFront
net.tcp://mycomputer:9000/StoreFront
Binding : 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
Nine predefined standard bindings
Can be customized
Custom binding
Standard bindings : Standard bindings
Custom bindings : Custom bindings Allows Specifying Custom Protocol Stacks
Built from Ordered Set of Binding Elements
[ContextFlowBindingElement]
[ReliabilityBindingElement]
[SecurityBindingElement]
[CompositeDuplexBindingElement]
TransportBindingElement
HTTP, TCP, Named Pipes, MSMQ
MessageEncoderBindingElement
Text, Binary, MTOM
Contract : Contract Defines what a service communicate
Supports contract first or code first models
Contract first = interfaces
May use WSDL first as well
Message vs. RPC style APIs
Service contract
Data contract
Service contracts : 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
Data contracts : Data contracts Defines data structures
Maps CLR types to XML Schema
[DataContract] specifies types
[DataMember] specifies members
Can be applied to private fields!
Built-in support for versioning
Behavior : Behavior Modifies or extends service or client runtime behavior
Examples
Instancing; Singleton, PrivateSession, SharedSession, PerCall
Concurrency; Multiple, Reentrant, Single
Throttling; connections, threading
Metadata
Transactions; AutoEnlist, Isolation, AutoComplete
Composable Features : Composable Features Address
Binding
Behavior
Contract
HTTP Transport TCP
Transport NamedPipe Transport MSMQ Transport Custom Transport WS-Security Protocol WS-RM Protocol WS-Coord 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
Runtime : Runtime Formats, sends and receives messages
Dispatches message to service operation
Attributes, code and config are used to dynamically create a ServiceHost instance
Precedence: attribute, code, config
Hosting : Hosting ASP.NET, .SVC format (andlt;%@Service %andgt;)
IIS 6: HTTP transport only
IIS 7: All transports
Windows Activation Service, WAS
Same process management, health, and activation features as IIS without requiring a Web server.
Self hosted, ServiceHostandlt;Tandgt;
Hosted in any CLR appDomain
All transports
IIS/WAS is the expected hosting model
Configuration : Configuration Section in app.config or web.config
The andlt;servicesandgt; Element
serviceType.
behaviorConfiguration
The andlt;endpointandgt; Element
address
bindingConfiguration
contractType
The andlt;bindingsandgt; Element
Contains the specifications for all bindings that can be used by any endpoint defined in any service.
Configuration : Configuration
Metadata : Metadata Exposed through WS-MetadataExchange Endpoints
Enabled by default, can be disabled through behavior
Consumed using svcutil.exe
Generates code and configuration
Tool can also generate proxy class
Diagnostics : Diagnostics Logging
Request and reply messages
Tracing
End-to-end trace of [correlated] events
WMI events
Performance monitor counters
Event Log
Mappings to SOA : Mappings to SOA Boundaries are Explicit
Service and data contracts
Services are autonomous
Independent deployment, versioning, and security
Share Schema, not Class
Integration based on message formats and exchange patterns, not classes and objects
Policy-based compatibility
Service compatibility based on policy assertions (behaviors)
Slide31 : Programming WCF
Building a WCF application : Building a WCF application Application Design
Service
Define Contracts
Implement Contracts
Define Endpoints
Host andamp; Run Service
Client
Generate Proxy from Metadata
Implement andamp; Run Client
Application Design : Application Design
Application Design : Order Service Admin Client Application Design Order Client
Define Contracts : Define Contracts Service Contracts
Order client and admin API (duplex)
Data Contracts
Shopping cart
Item
Implementing Contracts : Implementing Contracts
One class per service interface
Class may specify ServiceBehavior attributes
Defining Endpoints : Defining Endpoints One per service interface
wsProfileBinding, wsProfileDualHttpBinding
Rember WCF ABC!
Can be specified in code or configuration
Configuration is to be preferred
Hosting : Hosting Self hosted in console application
One ServiceHost per ServiceType
Generating Proxies : Generating Proxies Generated dynamically from service
svcutil.exe
Note: service must be running
Generate proxy and configuration files
svcutil http://localhost:8000/StoreFront /out:proxy.cs /config:app.config
Proxy Visual Studio add-in (community tool)
Implementing the Client : Implementing the Client Client configuration obtained from generated code
Statless server calls
Remember to close proxy correctly
Implementing the Admin Client : Implementing the Admin Client Again, client configuration obtained from generated code
Duplex callback interface implementation
Requires stateful connection!
Slide42 : Summary
Summary : Summary WCF is the next generation WS from Microsoft
Know your ABC
Define contracts first
Supports building SOA
But not limited to only that
Unified programming model
But be aware of consequences
Call to action! : Call to action! Download WinFx Beta 1
Includes .NET Framework 2.0, WCF (Indigo) Beta 1 and WPF (Avalon) Beta 1
http://www.microsoft.com/downloads/details.aspx?FamilyId=CE888B4C-CCBD-452F-9D90-F4B7190CCA24andamp;displaylang=en
WinFX SDK
http://www.microsoft.com/downloads/details.aspx?FamilyID=23a22468-5807-4ff7-a363-ce6fe69b8f04andamp;displaylang=en
WinFX Visual Studio 2005 extensions
http://www.microsoft.com/downloads/details.aspx?FamilyId=45F9BE99-3264-4BF1-8879-78A7A95D9217andamp;displaylang=en
Resources : Resources Programming Indigo
David Pallmann, MS Press, http://www.microsoft.com/mspress/books/7703.asp
Windows Communication Foundation
http://msdn.microsoft.com/webservices/indigo/default.aspx
Introducing Indigo: An Early Look
http://msdn.microsoft.com/webservices/indigo/default.aspx?pull=/library/en-us/dnlong/html/introindigov1-0.asp
Newsgroup
http://msdn.microsoft.com/longhorn/community/newsgroups/default.aspx?dg=microsoft.public.windows.developer.winfx.indigoandamp;lang=enandamp;cr=US