Fundamentals of Windows Communication Foundation
page 4 of 6
by Keyvan Nayyeri
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 15242/ 344

Service

Understanding the structure of services makes up your main knowledge in WCF programming.  Here I want to talk about different concepts around services.

Service Description

Each service is described by its description.  Descriptions show some information about the service.  For example, what it can do and how can you get access to it.

You can use four standards to describe the service:

·         WSDL

·         WS-Policy

·         WS-Metadata Exchange

·         XSD

You may be familiar with some of these standards from the past and traditional web services.

Binding

Bindings define the way that a service can communicate with other services and clients.  As we talked in previous sections, each channel has some characteristics and each binding uses a combination of various available properties for a channel.  There are some pre-defined bindings in Windows Communication Foundation, but you can write a custom binding for your own needs.  If you want to be a success in development for WCF, it is essential to have a good understanding about all pre-defined bindings and their properties.  This lets you to choose the correct binding which is an important part of WCF development.

Here is a list of all built-in bindings in WCF.  I strongly recommend you to read this article on MSDN to learn all properties for each binding type.

·         BasicHttpBinding

·         WSHttpBinding

·         WSDualHttpBinding

·         WSFederationHttpBinding

·         NetTcpBinding

·         NetNamedPipeBinding

·         NetMsmqBinding

·         NetPeerTcpBinding

·         MsmqIntergrationBinding

Some of these bindings are very common, like BasicHttpBinding and WSHttpBinding.  Some of these bindings support security mechanisms and are secure.  Some bindings support reliable sessions or duplex messaging.  Some of them support different encodings and contracts.

Contract

In WCF contracts define the structure of things.  There are three types of contracts:

·         Service Contract: A service contract defines what it does.  A service can have one or more service contracts.  Service contracts are similar to interfaces in Object Oriented Programming.  You implement an interface for your service logic.  For example, a service that operates as a calculator may have an ICalculator contract with four functions for add, subtract, multiply and divide and implements this interface in Calculator class.

·         Data Contract: Data contracts let you to pass custom objects to service operations.  Using data contracts you define a structure for your objects and pass them to methods.  For example, you may have a Person class that you the Person to be able to pass it to methods.

·         Message Contract: This is less common than previous contract types, but you can use message contracts to change the structure of your messages to use them in your application.  For example, you can change the body of a message.

Endpoint

Endpoints act like wharfs in ports.  They are the access points of a service.  An endpoint associates a service contract and binding with an address to let clients find the service and use it.  Having at least one endpoint is required for a service, but services can have more than one endpoint.

An endpoint contains its elements: Address, Binding, and Service Contract.  A client sends a request to the address then it will be passed to a service contract through a channel which is defined by binding.

There is a correlation between endpoints and addresses.  An address is created based on a few parameters:

·         The transport that is used for communication makes the prefix that will be used (http://, https://, net.tcp:// or …).

·         The place where the service is hosted.  As I said in the introduction article, a service can be hosted in a virtual directory on IIS or can have its own code for hosting.  Format for an address that is hosted on IIS is a bit different than the format for a service that is self-hosted.

·         The port that is used for communication.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 8 and 5 and type the answer here:

User Comments

Title: Request-Reply pattern is Synchronous   
Name: Shan
Date: 1/28/2008 2:56:58 AM
Comment:
You mentioned Request-Reply pattern is asnchronous but its waiting for response from service. So i believe this pattern is Synchronous one. Thanks for you Arthicle. Regards,Shan
Title: just some doubt   
Name: madhanMohan
Date: 7/19/2007 7:51:44 AM
Comment:
HI,
Just one small doubt, In above article "Request-Reply" pattern is defined as "two way asynchronous messaging pattern" but down when explaining the same it is specified that after sending a request client should wait for the reply from service(which is Synchronous i believe bcz as far i know in Asynchronous messaging client need not wait for server/service reply and meanwhile client can continue with its business).

It would be great if you clarify me.

Thanks,

Product Spotlight
Product Spotlight 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Ads Powered by Lake Quincy Media
Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 8/29/2008 7:38:24 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search