官术网_书友最值得收藏!

Chapter 2. Endpoint, Binding, and Behavior

In this chapter, we will cover:

  • Configuring Default Endpoints
  • Setting up two-way communication over MSMQ
  • Building a Publish-Subscribe service with dual binding
  • Creating a multiple-endpoint service
  • Implementing a POX HTTP service
  • Defining a CustomBinding without a timestamp header
  • Suppressing mustUnderstand validation on unknown SoapHeaders
  • Sharing a physical address between multiple endpoints

Introduction

WCF services are exposed through service endpoints, which provide the basic access point for client to utilize the functionality offered by a given WCF service. Service endpoints consist of ABC and a set of behaviors. What is ABC? Well, A stands for Address, which tells service consumers “Where is the service?”, B stands for Binding, which describes “How to talk to the service?” and C stands for Contract, which shows “What functionality can the service provide?”

WCF provides plenty of built-in bindings (such as BasicHttpBinding, NetTcpBinding, NetMsmqBinding, and so on), which can help developers host service endpoints over various transport protocols. Behaviors also play an important role in WCF. By using behaviors, we can gain further manipulation over the WCF service at service or endpoint level.

This chapter provides eight recipes on using the built-in binding and behaviors to build various service endpoints, which represent some of the useful scenarios in general WCF service development. We will start from the Default Endpoint feature introduced in WCF 4.0. Then, we will use two built-in bindings (NetMsmqBinding and WSDualHttpBinding) to demonstrate how to build a two-way communication and build a Publish-Subscribe pattern service through system bindings. The fourth recipe shows how WCF allows a single service to expose multiple endpoints layered on heterogeneous transport and message settings. The fifth recipe demonstrates how to build a POX-style WCF service that can talk with the application, which only supports plain XML-based message communication. The last three recipes come from some common and tricky scenarios in service endpoint customization. The sixth recipe shows how to disable the replay detection and remove a timestamp header in a WCF-generated SOAP message, the seventh recipe demonstrates how to make a WCF service/client tolerant to anonymous SoapHeaders, and the final recipe provides an example of how to make multiple WCF endpoints share a single transport address.

主站蜘蛛池模板: 呼和浩特市| 长沙市| 酒泉市| 乌兰察布市| 郧西县| 监利县| 元氏县| 昌吉市| 海阳市| 松江区| 英超| 吴旗县| 太康县| 五原县| 资中县| 进贤县| 贵南县| 温州市| 黄陵县| 涿州市| 丽水市| 开封县| 高要市| 苍溪县| 焉耆| 报价| 百色市| 偏关县| 离岛区| 侯马市| 迁西县| 隆林| 二连浩特市| 宜阳县| 舟山市| 湖南省| 昆山市| 灌南县| 无棣县| 平原县| 宝丰县|