explains how the service may be accessed by the client
3 elements needed to define an endpoint
address
binding
contract
Endpoint element - address
a full network address where the service is being hosted
Endpoint element - binding
a description of the communication protocol the client is expected to use to communicate with the service
Endpoint element - contract
a description of the semantics required to exchange messages with the service
and interface with method prototypes
object that implements a service contract vs. one that defines a data contract
implementing a service contract is hosted by the service and never by the client.
defining data contracts are serialized by the service and deserialized by the client so the client has a local copy of the object.
How can an interface definition be transformed into a WCF service contract?
An interface can be decorated with the [ServiceContract] attribute and its methods decorated with the [OperationContract] attribute.
How can a data class definition be transformed into a WCF data contract?
a data class can be decorated with the [DataContract] attribute and its member variables decorated with the [DataMember] attribute.
BasicHttpBinding
suitable for cross-platform communication
.NET client consumes a Web Service
uses XML-based messaging (not efficient)
NetTcpBinding
only suitable for communication between .NET clients and services.
binary format (efficient)
NetNamedPipeBinding
built-in binding only works for pure .NET solutions running on a single computer
3 instance context modes in WCF
Single
PerCall
PerSession
PerCall
new object is activated to service each method call
PerSession
new object is activated to service each client session
How can the programmer assign a particular instance context mode for a service object?
decorating a class with with variations of the [ServiceBehaviour] attribute.
e.g. [ServiceBehaviour(InstanceContextMode = InstanceContextMode.PerCall)]
2 ways a WCF client project in VS can obtain metadata about a WCF service contracts
1. adding a reference to a custom library containing the required service and data contracts.
2. adding a service reference to the specific service as long as the service is running at the time and the service supports MEX
MEX
metadata exchange
Latter technique
a proxy class will be generated in the client project which hides any WCF-specific code.
callback contract
a service contract that is implemented by a client of a WCF service and used by the service to update the client whenever a significant event has occurred in the service object.