Home > WCF > WCF # 8 – WCF Contracts

WCF # 8 – WCF Contracts

Hi ,

Today we will see the most important concept in the WCF Framework called CONTRACTS.

* IN every day world , a contract is a binding agreement between two or more parties that specifies the supply of goods or services for a known price.

* In the world of WCF, a contract has a similar function: It’s an agreement between two or more parties that specifies the messages that can be exchanged and the terms and conditions of those messages.

* A contract is a description of the messages that are passed to and from service endpoints. Each endpoint is defined by the ABCs: an addressable location on the network where messages are sent, a binding that describes how messages are sent, and a contract that describes the message formats.

For More on ABC’s visit this link Endpoints ABC’s

* A Service is really a collection of endpoints, and the endpoints implement the specific algorithms in code. They can implement high-level business functions, such as entering orders into a fulfilment system,or they can be more fine-grained, such as looking up a customer’s
address. High-level functions typically require complex data structures,whereas targeted functions often work in more basic data types. In either case, an endpoint must specify the operations it implements and the data formats it expects. Together, these specifications make up the contract

* There are three types of contracts in WCF:

Service contracts. Service contracts describe the functional operations implemented by the service. A service contract maps the class methods of a .NET type to WSDL services, port types, and operations.Operation contracts within service contracts describe the service
operations, which are the methods that implement functions of
the service.

Data contracts. Data contracts describe data structures that are used by the service to communicate with clients. A data contract maps CLR types to XML Schema Definitions (XSD) and defines how they are serialized and DE serialized. Data contracts describe all the data
that is sent to or from service operations.


Message contracts. Message contracts map CLR types to SOAP messages and describe the format of the SOAP messages and affect the WSDL and XSD definitions of those messages. Message contracts provide precise control over the SOAP headers and bodies.

NOTE :

To make contracts interoperable with the widest range of systems, they are expressed in Web Service Description Language(WSDL). So, before going too much further in discussing contracts, a short review of WSDL is helpful. According to the W3C, the standards body through which industry vendors (Microsoft, IBM, and so on) defined the WSDL specification.

[WSDL :-

WSDL is an XML format for describing network services as a set of endpoints
operating on messages containing either document-oriented or
procedure-oriented information. The operations and messages are
described abstractly, and then bound to a concrete network protocol and
message format to define an endpoint. Related concrete endpoints are
combined into abstract endpoints (services). WSDL is extensible to allow
description of endpoints and their messages regardless of what message
formats or network protocols are used to communicate[;] however, the
only bindings described in this document describe how to use WSDL in
conjunction with SOAP 1.1, HTTP GET/POST, and MIME.]

WSDL Elements are  as follows :-

image

 

In further posts we will go in depth with each Contract Types.

Thanks.

Advertisements
Categories: WCF
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: