Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

An endpoint is composed of 4 elements (address, binding, contract and behavior) which collectively describe what the service can do, in what format the data will be provided and how clients can reach the service.   In order to make sense of the terms used to describe the elements of an endpoint, I will use a real-life analogy as an example:  You are tasked with getting an important message to a recipient on the other side of the city at 1600 Pennsylvania Avenue and it must make it there by a specific time.

Addresses

The most obvious element of an endpoint is its address.  It tells clients where to reach the service.  In our real-life example, that would be 1600 Pennsylvania Avenue and in a computer, it may be a URL such as mytravelagency.com.  WCF defines an object named EndpointAddress to hold this address.  It contains some other additional properties which I won't go into detail now to keep this introduction simple.

...

The 3rd element in an endpoint is the contract.  Contracts simply spell out what functionality (operations) the service can provide, how to specify any inputs it may be required to act on your request and how the data will be provided back to you.  For example, it makes no sense to send a message to 1600 Pennsylvania Avenue that says "List trips on sale" as that it's not an function the entity at that address can provide.  Thus a service must provide all the functions it can support and the inputs and responses for each of those functions.  Any slight deviation from that contract and the service cannot provide the clients what they seek.  We'll spend more time on contracts later when creating our first service.

...

A second message pattern is one where the client simply sends a message to the service and doesn't expect a reply.  This is called the one-way pattern.  Note that there is no reply from the service so the client can't be certain that its message was received by the service. Furthermore, even if the message was received but during its handling, the service encountered a problem, there is no mechanism for notifying the client of such a problem.  One important aspect of this pattern is that from the perspective of the client, the call is going to appear to be asynchronous.  Namely, it is going to send the message and continue its execution.   While it may appear that way, this is not 100% correct... if the service is running slower and can't process the incoming requests fast enough, an incoming message can't be accepted and will block the client.  We'll simulate this later when we look at code.  

This pattern can used for sending status or metrics to the service or for periodically saving data a customer may be typing into a browser from (such as when you edit a wiki document).  In our travel agency example, you may use the one-way messages when a customer clicks on the icon to add a trip to her "favorite trips"  list.

...

Duplex communication between the client and service.  Each uses its own one-way pattern to exchange messages.


References


What's Next?

Next, let's create a WCF Service: WCF For Beginners - Part 2: Creating A WCF Service