Click here to Skip to main content
15,891,828 members
Articles / All Topics

Understanding WCF in Depth - Part 3

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
28 Jan 2015CPOL2 min read 6.9K   6  
Understanding WCF in depth - Part 3

Prerequisites: Understanding WCF in depth Part – 1 , Understanding WCF in depth Part – 2

In this part, we will look at why endpoints were required?

From the previous article, we know the actual layers of channel stack, thus to build the channel stack configuration; ordering is important. This again is a tedious process and to remove this problem, WCF provides a concept called as Endpoints.

Now what is Endpoints?

For simplicity, let us assume that you want to deliver a message or a parcel to your friend. What you generally do is:

  1. Determine what the parcel is
  2. Pack it and write the address (where) on the Parcel for delivery
  3. Determine how you want to send the parcel, e.g. air, rail, road, etc.

The same process is followed when you want to send a message using WCF. You create an Endpoint.

Endpoints consists of 3 fundamental things (ABCs of WCF),

  1. Address: As to where you want to send the Message. Endpoint consists of Uri: which represents the address of the service and Identity: which represents the security identity of the service and a collection of optional message headers.
  2. Binding: How you want to send the Message (e.g., HTTP, TCP, etc.). The Binding provides the recipe for building the channel stack. For binding, you would need to define the Protocol (Context flow settings, security, and reliability), Transport (TCP, HTTP etc.) and Message Encoding (Text, Binary, MTOM).
  3. Contract: What message you want to send and how it is exposed to the client. It specifies what operations can be called by a client, the form of the message, the type of input parameters or data required to call the operation and what type of processing or response message the client can expect.

A sample Endpoint through web.config is as shown below:

XML
<endpoint address="http://localhost:8001/hello/servicemodelsamples"
                binding="wsHttpBinding"
                contract="Microsoft.ServiceModel.Samples.ICalculator" />

There are different types of bindings available, we will look at the features in brief of the most commonly used bindings:

  1. BasicHttpBinding
    • Interoperability
    • Uses HTTP for Transport and Text for Encoding using SOAP 1.1 standard
    • Transport/Message security
    • Simple Channel Stack thus simple to implement
  2. WSHttpBinding
    • Interoperability + richer web service protocol for security, message & transactions
    • HTTP for transport & text encoding using SOAP 1.2 and WS Addressing 1.0
    • Message security
    • Sophisticated channel stack, thus used majorly for enterprise scenarios where integration across Framework and platform is required.
  3. NetTcpBinding
    • No Interoperability
    • TCP for transport and binary message encoding using SOAP 1.2
    • Transport security
    • Better performance channel stack for COM+ and .NET remoting components
  4. CustomBinding: While building Custom Binding, one needs to maintain the sequence which is shown below, the ones with “Required” are mandatory and should be defined.
    • Transaction Flow
    • Reliable Messaging
    • Message security
    • Composite Duplex
    • Message Encoding –Required
    • Transport Security
    • Transport — Required

In the next post, we will look at some of the Contracts and its usage. :)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
India India
Passionate about Microsoft Technologies like WPF, Windows Azure, ASP.NET, Win Phone and also on Cross platform Mobile Apps, Mongo DB's, IOT & WOT. I love learning and working with (or) Creating Design Patterns . Writer | Technology Evangelist | Technology Lover | Microsoft Developer Guidance Advisory Council Member | Cisco Champion | Speaker |

Blog : http://adityaswami89.wordpress.com/

Comments and Discussions

 
-- There are no messages in this forum --