| Slide 7 |
A Channel is the conduit through which all messages pass to and from WCF applications. It is responsible for preparing and delivering messages in a consistent way.
Channels are layered together to create a channel stack.
The goal of a channel stack is to transform a message into a wire format compatible with the sender and receiver and to transport the message.
|
| Slide 14 |
TP : TCP, HTTP, IPC, MSMQ, Custom
Encoding: Text, Binary, Custom
Security: WCF is secure by default. By default, WCF supports X509 certificates and Username/password, as well as Kerb and SAML tokens. Of course, custom tokens can be written and plugged into WCF as well, and WCF also supports anonymous access if the service chooses to.
Reliability: When we talk about reliable messaging (RM), we’re talking about a guarantee that a message actually gets from one service to another (retrying on failed attempts until success). WCF supports two RM guarantees: in-order and exactly once (similar to MSMQ and MQSeries guarantees).
Transactions: WCF also supports transactions
It’s also important to point out that security, RM, and transaction support are all configured by default to communicate using Web Services specification-compliant protocols (WS-Security, WS-ReliableMessaging, WS-AtomicTransaction, etc). This provides a new level of integration between services built on our platform and built on other vendor's platforms (WebSphere, etc).
|
| Slide 18 |
In WCF, all services expose contracts. The contract is a platform-neutral and standard
way of describing what the service does.
|
| Slide 20 |
In the future, if you
need to have another client that has different binding requirements, all you need to do is
create another endpoint in the configuration file.
more clients requiring the same business logic encapsulated in the service with different technical
capabilities.
|
| Slide 23 |
svcutil.exe http://localhost:2615/Service1.svc/mex
svcutil.exe http://localhost:2615/Service1.svc?wsdl
Metadata publishing for this service is currently disabled.
|
| Slide 1 |
Demystifying Windows Communication Foundation
|
| Slide 2 |
Outline
Technology Trends
WCF Design Goals
Mechanics of Communication
ABCs of WCF
Endpoints
Hosting Options
Creating Proxy
Demo
|
| Slide 3 |
Outline
Service Contracts - Operation Overloading
Message Exchange Patterns
Handling Errors
Synchronous and Asynchronous Calls
Instance Management
|
| Slide 4 |
Technology Trends
|
| Slide 5 |
Moving From Problem >> Solution
Scenario
App A >> Http >> Uses Programming Model A
App B >> Tcp >>Uses Programming Model B
What if you want to switch App A to using TCP?
You’ll have to learn Programming Model B
Why not have just one technology that can be used in all situations ??
|
| Slide 6 |
What is the observation ??
|
| Slide 7 |
Lets Understand ..
Host – Why do we need it?
What is the basic flow from Client to Service ?
Channel – Channel Stack ?
Proxy – Analogy
Web Services or Services ?
|
| Slide 8 |
What do we GAIN with WCF ??
Reducing Coding and Complexity of
Developing
Deploying
Managing
Distributed Applications
Multiple hosting options
Availability
Scalability
|
| Slide 9 |
Services
Or
Web Services ?
|
| Slide 10 |
WCF - Design Goals
|
| Slide 11 |
Mechanics of Communication
Client
Service
What do I send ?
Where do I send ?
How should I send it ?
Contract
Address
Binding
|
| Slide 12 |
ABCs of WCF
|
| Slide 13 |
Address
http://localhost:8000/MyService/
|
| Slide 14 |
What goes into a Binding ?
|
| Slide 15 |
Binding Options
Built in – WCF Standard Bindings
Tweak Existing Binding
Write Custom Bindings
|
| Slide 16 |
Choosing a Binding
|
| Slide 17 |
Binding Configuration
<services>
<service name = "MyService">
<endpoint address = "net.tcp://localhost:8000/MyService/"
bindingConfiguration = "TransactionalTCP"
binding = "netTcpBinding"
contract = "IMyContract"
/>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name = "TransactionalTCP"
transactionFlow = "true"
/>
</netTcpBinding>
</bindings>
|
| Slide 18 |
Contracts
|
| Slide 19 |
<system.serviceModel>
<services>
<service name = "MyNamespace.MyService">
<endpoint
address = "http://localhost:8000/MyService/"
binding = "wsHttpBinding"
contract = "MyNamespace.IMyContract"
/>
</service>
</services>
</system.serviceModel>
An EndPoint
|
| Slide 20 |
One Service Multiple Endpoints
|
| Slide 21 |
Multiple End Points
<service name = "MyService">
<endpoint
address = "http://localhost:8000/MyService/"
binding = "wsHttpBinding"
contract = "IMyContract"
/>
<endpoint
address = "net.tcp://localhost:8001/MyService/"
binding = "netTcpBinding"
contract = "IMyContract"
/>
</service>
|
| Slide 22 |
End Points
Administrative configuration
Programmatic configuration
|
| Slide 23 |
Exchanging Metadata
A service has two options for publishing its metadata :
Over the HTTP-GET protocol
A dedicated endpoint MEX EndPoint
|
| Slide 24 |
Creating Proxy
Add Service Reference - ASR
Svcutil
Channel factory<T>
|
| Slide 25 |
Hosting Options
|
| Slide 26 |
Demo
Building a WCF Service
Hosting the service
Multiple Endpoints
Programmatic /Administrative
Contracts
Interoperating with ASMX service
|
| Slide 27 |
Demo
Creating a proxy
ASR
Svcutil
ChannelFactory
Consuming the service
|
| Slide 28 |
Service Contract
Operation Overloading
Enabling Service side Operation Overloading
Enabling Client side Operation Overloading
|
| Slide 29 |
Demo
Operation Overloading
Enabling at service side
Enabling at client side
|
| Slide 30 |
Handling Errors
Faults and Exceptions
Fault Contracts
Generating and Handling Faults
|
| Slide 31 |
Demo
Unhandled Exceptions
Fault Exception
Fault Exception <T>
Fault Contract
|
| Slide 32 |
Synchronous Vs Asynchronous
|
| Slide 33 |
Demo
Synchronous calls
Versus
Asynchronous calls
|
| Slide 34 |
Message Exchange Patterns
Request Response
One Way
Duplex
|
| Slide 35 |
Request and Response
Default Operation mode
Exactly one reply for each request and is always initiated by the client
With the exception of the
NetPeerTcpBinding
NetMsmqBinding,
all bindings support request-reply operations.
|
| Slide 36 |
One Way
“Fire and Forget”
One-way operations cannot return values
One-way calls do not equate asynchronous calls.
All the WCF bindings support one-way operations.
|
| Slide 37 |
Duplex
Messages can be sent from either the client or the server
Duplex communication uses two one-way channel
An example of duplex communication is an event notification system.
|
| Slide 38 |
Callback Operation
Not all bindings support callback operations.
We cannot use callbacks over BasicHttpBinding or WSHttpBinding
To support callbacks over HTTP, WCF offers the WSDualHttpBinding, which actually sets up two HTTP channels
|
| Slide 39 |
Demo
Message Exchange Pattern
Request Response
One Way
Duplex
|
| Slide 40 |
Instance Management
Per Call
Singleton
Per Session
|
| Slide 41 |
Demo
Instance Management
Per Call
Singelton
Per Session
|
| Slide 42 |
Thank You !!
|