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

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.

主站蜘蛛池模板: 苏尼特左旗| 平度市| 新河县| 凌源市| 平山县| 永登县| 密山市| 普安县| 津南区| 明溪县| 林周县| 托克托县| 成都市| 株洲市| 建昌县| 永顺县| 石渠县| 普兰店市| 南康市| 临沧市| 紫金县| 宁陕县| 佛学| 寻乌县| 商城县| 德保县| 凤山县| 邛崃市| 巴南区| 易门县| 盐源县| 南雄市| 平邑县| 濉溪县| 木兰县| 灵宝市| 普格县| 巢湖市| 湟中县| 和平区| 若羌县|