WCF Master Pieces

WCF Master Pieces

DOI: 10.4018/978-1-5225-1997-3.ch002
OnDemand PDF Download:
No Current Special Offers

Chapter Preview


Overview Of Endpoint

The endpoint is the glue between service and client. Communication between client and service is done through the endpoint. Through endpoint a message is passed between client and service. A service must have at least one endpoint without which communication is not possible. It is like a USB port for communication between a computer and a pen drive or any other USB device. Furthermore, at least one USB port is required for communication otherwise data transfer is not possible. In Figure 1, a communication between a WCF service and .NET client through endpoint is presented. Once a client communicates with the service through particular endpoint it sends and receives message through that endpoint only. It is not possible that a client sends a message through one endpoint and receives message via another endpoint. An endpoint contains mainly three parts:

  • 1.


  • 2.


  • 3.


Each part is introduced in Chapter 1. In this following section these parts are discussed in depth.

Figure 1.

Endpoint between service and client



Every endpoint must have unique address which is known as endpoint address. As WCF allows using different protocols such as Http, TCP, MSMQ etc. the format of address must be different for each protocol. An address specifies where the service is located without which it is not possible to communicate with the service. Therefore a service must provide the address in the endpoint element. There are different types and formats of address which is discussed in Chapter 4.


Binding defines how to communicate between service and client. It contains details such as protocol for security, transaction and reliable messaging. For instance, it is like deciding a transport when decide to commute from one place to another. A two wheeler vehicle might be easy to drive, but security is less as compared four wheeler vehicle. Furthermore, rule or protocols to drive a two wheeler are different than the rules or protocol to drive a four wheeler vehicle. Therefore, it is up to the user to choose the transport based on his/her choice and requirement. If security is not the essential requirement than a two wheeler vehicle might be the suitable option otherwise four wheeler vehicle can be chosen.

In WCF, there are some built-in bindings available. Some of the commonly used bindings are BasicHttpBinding, wsHTTPBinding, netTcpBinding and wsDualHttpBinding. Likewise, there are other built-in bindings available in WCF which are not listed here. A binding decides what kind of communication should be done between service and client. So bindings are more suitable for interoperability and there is less security or no security in these bindings. Moreover, the protocol of the address depends upon the type of binding selected. The binding must match with the protocol of address. For example, if a programmer chooses to use wsHTTPBinding, the protocol of address must be http or https. Using other protocols such as netTcpBinding results in the error while hosting the service. Apart from this built-in binding, a programmer can build custom binding also. The discussion on how to program the binding is included in Chapter 5.

Complete Chapter List

Search this Book: