Readings for Windows Communication Foundation (WCF)

advertisement
COMPSCI 711
WCF
radu/2008
Readings for Windows Communication Foundation (WCF)
o [main] Learn The ABCs Of Programming Windows Communication Foundation
Aaron Skonnard, MSDN Magazine, February 2006
o [complementary] Serialization in Windows Communication Foundation
Aaron Skonnard, MSDN Magazine, August 2006
o [complementary] WCF Messaging Fundamentals
Aaron Skonnard, MSDN Magazine, April 2007
o [complementary] WCF Addressing In Depth
Aaron Skonnard, MSDN Magazine, June 2007
o [complementary] WCF Bindings In Depth
Aaron Skonnard, MSDN Magazine, July 2007
o [reference] MSDN Library
.NET Development / .NET Framework SDK /.NET Framework / Windows
Communication Foundation / …
1.7
COMPSCI 711
WCF
radu/2008
Windows Communication Foundation and Service Orientation
o Main tenet of SOA: loose coupling.
o Is Remoting (RMI, CORBA) loose coupled?
 Consider updates, partial failures, network failures, network latency.
o Is WCF really loose coupled?
o Aren’t we using WCF to much in the distributed object style?
o Quote:
The (now well documented and understood) problem with this approach [distributed objects] is that
distributed objects can't be designed like other objects.
For performance reasons, distributed objects have to have what Martin Fowler called a "coarsegrained interface", a design which sacrifices flexibility and extensibility in return for minimizing the
number of cross-network calls.
Because the network overhead can't be abstracted away, distributed objects are a very leaky
abstraction.
A bird’s eye view of distributed applications: past and future
Harry Pierson, http://www.devhawk.net/2007/08/14/Retire+The+Tenets.aspx
2.7
COMPSCI 711
WCF
radu/2008
Windows Communication Foundation and Service Unification
WCF is a modular (orthogonal plugins), configurable (properties, behaviours) extensible framework
that unifies existing high-level communications
o ASP.NET Web services (ASMX)
o WSE services (addressing/routing, security, attachments, standalone)
o Distributed Objects with .NET Remoting (≈ RMI, CORBA, COM/DCOM)
o Enterprise Services (transactions, COM+)
o Message queues (MSMQ)
o also connections to Workflows (e.g., BizTalk)
3.7
COMPSCI 711
WCF
radu/2008
Service ABC
o Service
o Endpoints
 Address
 Logical and physical, Uri
 Binding
 Transport protocols: HTTP, HTTPS, TCP, MSMQ, P2P, PIPE, …
 WS Protocols: WS-* (Basic, Ws-Addressing, WS-Security, WS-MetadataExchange, …)
 Message type/version: SOAP1.1 vs SOAP1.2 (XML with envelope), POX (XML),
JSON (Javascript), …; and encoding: Text, Binary, MTOM (text+binary atatchments)…
 Contract
 Data contract: DataContractSerializer (opt PreserveObjectReferences),
NetDataContractSerializer, XmlObjectSerializer, XmlSerializer, …,
 Message contract: directly describe the XML mapping and SOAP envelope, incl headers
4.7
COMPSCI 711
WCF
radu/2008
Builtin Bindings (partial list)
Binding Class Name
BasicHttpBinding
WSHttpBinding 1
Default
Transport
HTTP
HTTP
Default Message
Encoding
XML Text
XML Text
WSDualHttpBinding 1 2
HTTP
XML Text
WSFederationHttpBinding
HTTP
XML Text
NetTcpBinding 1 2
NetPeerTcpBinding
NetNamedPipesBinding 1 2
NetMsmqBinding
MsmqIntegrationBinding
CustomBinding
TCP
P2P
Named Pipes
MSMQ
MSMQ
You Decide
Binary
Binary
Binary
Binary
uses pre-WCF
You Decide
o 1 builtin transaction support
o 2 builtin dual messaging support
5.7
Default Message
Version
SOAP 1.1
SOAP 1.2 WSAddressing 1.0
SOAP 1.2 WSAddressing 1.0
SOAP 1.2 WSAddressing 1.0
SOAP 1.2
SOAP 1.2
SOAP 1.2
SOAP 1.2
uses pre-WCF
You Decide
Def Security
Mode
None
Message
Message
Message
Transport
Transport
Transport
Message
Transport
You Decide
COMPSCI 711
WCF
radu/2008
Basic scenario for our samples (based on the .NET samples)
ServiceHost
Client
Proxy (channel)
CalculatorClient
EP
ABC
SOAP …
EP
ABC
Metadata WSDL+XSD
6.7
ICalculator
CalculatorService
COMPSCI 711
WCF
radu/2008
Basic setup for our samples
o ServiceHost & Proxy constructors indicate whether we want a setup
o by code, or
o by config files (often automatically generated)
Proxy (here aka “channel”)
o typically automatically generated
o svcutil
o or programmatically created using a
channel factory
o mimics the service class (but not identical)
o and its interfaces
o optionally, convenience methods for async
calls
o using IAsyncResult
o using event-based
o
o
o
o
o
ServiceHost
service class, with
o zero, one or more interfaces
service base Uri
one or more service endpoints, each with
o one of the “contract” interfaces
o a binding, such as BasicHttpBinding
 WSHttpBinding
o a name, absolute or relative Uri
optional metadata endpoints
o usu by appending “mex”
an optional HTTP GET metadata
o usu by appending “?wsdl”
7.7
Download