Académique Documents
Professionnel Documents
Culture Documents
Figure 1
the service. The classes used for sending and receiving messages have data contr
act attributes associated with them.
Service contract, the service contract is used to define the WSDL that describes
the service. This contract is defined with interfaces or classes.
Operation contract, the operation contract defines the operation of the service
and is defined within the service contract.
Message contract, if complete control over the SOAP message is needed, a message
contract can specify what data should go into the SOAP header and what belongs
in the SOAP body.
Fault contract, the fault contract defines the error messages that are sent to t
he client.
Service Behavior
Specifies the internal execution behavior of a service contract implementation.
Apply the ServiceBehaviorAttribute attribute to a service implementation to spec
ify service-wide execution behavior. (To specify execution behavior at the metho
d level, use the OperationBehaviorAttribute attribute.) This attribute can be ap
plied only to service implementations.
Binding
Bindings are objects that are used to specify the communication details that are
required to connect to the endpoint of a Windows Communication Foundation (WCF)
service. Each endpoint in a WCF service requires a binding to be well-specified
.
The information in a binding can be very basic, or very complex. The most basic
binding specifies only the transport protocol (such as HTTP) that must be used t
o connect to the endpoint. More generally, the information a binding contains ab
out how to connect to an endpoint falls into one of the following categories:
Determines the security mechanism being used: either reliable messagin
Protocols
g capability or transaction context flow settings.
Encoding Determines the message encoding (for example, text or binary).
Transport
Determines the underlying transport protocol to use (for example, TCP
or HTTP)
Depending on the binding, different features are supported. The bindings startin
g with WS are platform independent, supporting web services specifications. Bind
ings that start with the name Net use binary formatting for high-performance com
munication between .NET applications.
Hosting
WCF can be host in Windows service, a COM+ application, WAS (Windows Activation
Services) or IIS, a Windows application, or just a simple console application. W
hen creating a custom host with Windows Forms or WPF, you can easily create a pe
er-to-peer solution.
Clients
A client application needs a proxy to access a service. There are three ways to
create a proxy for the client:
Studio Add Service Reference, this utility creates a proxy class from the metada
ta of the service.
ServiceModel Metadata Utility tool (Svcutil.exe), you can create a proxy class w
ith the Svcutil utility. This utility reads metadata from the service to create
the proxy class.
ChannelFactory class, this class is used by the proxy generated from Svcutil; ho
wever, it can also be used to create a proxy programmatically.