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

Message

Message is the key in WCF.  Without messages we do not have anything!  As I stated in the first part, services, clients and intermediaries communicate with each other via messages.  They send and receive messages in order to do things.

Structure

First, it is better to give a background about message structure in WCF.  Each message in WCF is an XML document (especially SOAP Envelope) that consists of two main parts: headers and body.

Each message may contain one or more headers, but only has one body.  Headers are some means that infrastructures or developers consume and they are mainly used to represent some information about the message itself.  The body is what we (developers) should care about because most of our codes will be applied to the body.  The body is where our data is located.

Patterns

Based on our needs in WCF we deal with messages in one of following three patterns:

·         Simplex: This is a one way messaging pattern.

·         Request-Reply: This is a two way asynchronous messaging pattern.

·         Duplex: This is a two way synchronous pattern.

Let us take a look at these three patterns in more detail.

In simplex pattern, which is a one way asynchronous pattern, you send a message from client to service and nothing more (Figure 1).

Figure 1:

In the request-reply pattern the client sends a request to the service and waits until it returns a reply back.  Nothing can happen in this between service and client.  Request-reply is a common pattern for internet users and everyday you deal with this pattern on internet.

Figure 2:

In the duplex pattern the client and service can communicate with each other regardless of anything that is going on between them so a client can send a message to the service and the service can send a message to the client.  Here, neither the client nor service needs to wait.

Figure 3:


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 3 and 2 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:04:34 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search