2. Agenda
What is WCF
From object to service
SOA , ESB
ASMX & WCF
WCF architecture
Ways of talk [Client – Service]
Service Provider , Consumer
ABC’s of WCF
Hosting WCF
Advantage , Disadvantages
Demos
ARCOM-KSA
2
3. What is WCF?
ARCOM-KSA
3
Stands for Windows Communication Foundation
Microsoft’s unified programming model (the service model) for building Service-
Oriented [SOA] apps
4. From Objects to Services
Polymorphism
Encapsulation
Subclassing
Message-based
Schema+Contract
Binding via Policy
1980s
2000s
Interface-based
Dynamic Loading
Runtime Metadata
1990s
Object-Oriented
Service-Oriented
Component-Based
ARCOM-KSA
4
5. What’s SOA - ESB
software architecture model
used for designing and implementing the
interaction between mutually interacting
software applications in (SOA)
ARCOM-KSA
5
software design and software architecture design pattern
discrete pieces of software application functionality as services
A service is a self-contained unit of functionality
SOA (service oriented architecture)
ESB (Enterprise Service Bus)
6. ARCOM-KSA
ASMX is limiting WCF is powerful
6 ASMX & WCF
Xml web services
HTTP-only hosting in IIS
No support for security
Advanced scenarios require mixing
models
highly configurable and highly extensible
supports what ASMX cannot
supports a unified programming model
across all protocols
8. Ways to Talk
One Way
Request-Reply
Duplex (Dual)
ARCOM-KSA
8
Client Service
One Way: Datagram-style delivery
Request-Reply : Immediate Reply on same logical thread
Duplex Reply : “later” and on backchannel (callback-style)q
11. ServiceClient
Address, Binding, Contract [WCF]
A
d
d
r
e
ARCOM-KSA
11
ABC
A B C
A B C
Message
Address Where the service is
Binding How to talk to the service
Contract What the service can do
12. ABC’s Cont. [Address]
ARCOM-KSA
12
Combination of transport, server name, port & path
Transport is determined by the binding
Examples
http://localhost:8001
net.tcp://localhost:8002/MyService
net.pipe://localhost/MyPipe
net.msmq://localhost/private/MyService
net.msmq://localhost/MyService
A
13. ABC’s Cont. [Bindings]
ARCOM-KSA
13
Transport
HTTP
TCP
MSMQ
Message formats and encoding
Plain text
Binary
Message Transmission Optimization Mechanism (MTOM)
Communication security
No security
Transport security
Message security
B
14. ABC’s Cont. [Contracts]
Service
Contract
Defines Operations,
Behaviors and
Communication Shape
What does your
service do
Data
Contract
Defines Data entities
and parameter types
What object data is
used
Message
Contract
Allows defining
application-specific
headers and
unwrapped body
content
Allows control over the
SOAP structure of
messages
Fault
Contract
Defines error types
ARCOM-KSA
14
C
16. Demos
ARCOM-KSA
16
Hello WCF
Edit WCF Configuration
Add services
Add end points
Binding configuration
Consume WCF
Service Reference
Using Code First
WCF Using UML [Class Diagram]
WCF Architecture Code
Service
Service.Contracts
Service.Business
17. Advantage
ARCOM-KSA
17
You can create new components for security, transport, authentication.
No much change in code for implementing the security model ,, Small changes in the
configuration will make your requirements.
Its faster than ASMX
Its Interoperability, for java, and more.
WCF is interoperable with other services
WCF services provide better reliability and security.
18. Disadvantage
ARCOM-KSA
18
WCF is Microsoft's implementation of SOA its APIs are solely controlled by MS which
makes interoperability a bit difficult.
deploy WCF apps, need more underlying hardware