What is an “endpoint” in WCF?

走远了吗. 提交于 2019-12-02 15:24:22
casperOne

An endpoint is what a service exposes, and in WCF terms, is made up of three things:

  • Address
  • Binding
  • Contract

Address is the URL by which the endpoint can be reached.

Binding dictates transformations that are applied as well as the shape (to some degree) of the messages sent to the implementation of the Contract at the Address.

Contract dictates what operations are being exposed at the address. It's exactly what it says it is, it's a contract to indicate what calls are permissible.

Most of the time, people remember it as A B C.

Some things to note:

The binding is typically going to be a combination of channels with behaviors applied; channels being elements on the channel stack which modify the message and perform actions before they get to the service implementation.

While commonly represented by an interface in .NET, it is not a requirement that a Contract be represented in this manner. Some design-first advocates will define the schemas to the messages that are going to be sent for the request and the response first, which is what WCF transforms the .NET Contract interface into.

draconis

I'm going to cite Juval Lowy's Programming WCF Services here:

Every service is associated with an address that defines where the service is, a binding that defines how to communicate with the service, and a contract that defines what the service does. This triumvirate governing the service is easy to remember as the ABC of the service.

WCF formalizes this relationship in the form of an endpoint. The endpoint is the fusion of the address, contract, and binding.

Every endpoint must have all three elements, and the host exposes the endpoint.

Endpoints in WCF
WCF Service is a program that exposes a collection of Endpoints. Each Endpoint is a portal for communicating with the world. End point consists of three components.
1) Address :
   Defines where a service is located
   ex - http://www.test.com:8001/MyService
2) Bindings :
   A binding that specifies how a client can communicate with the endpoint.
   ex - BasicHttpBinding,WSHttpBinding,WSDualHttpBinding etc
3) Contracts :
   A contract that identifies the operations available

Endpoints will be mentioned in the web.config file on the created service.

A Service Endpoint has an Address, a Binding, and a Contract. The Endpoint's Address is a network address where the Endpoint resides. The EndpointAddress class represents a WCF Endpoint Address. The Endpoint's Binding specifies how the Endpoint communicates with the world including things like transport protocol (e.g., TCP, HTTP), encoding (e.g., text, binary), and security requirements (e.g., SSL, SOAP message security). The Binding class represents a WCF Binding. The Endpoint's Contract specifies what the Endpoint communicates and is essentially a collection of messages organized in operations that have basic Message Exchange Patterns (MEPs) such as one-way, duplex, and request/reply. The ContractDescription class represents a WCF Contract.

See here: A service endpoint specifies an address, a binding, and a contract to use for communication.

A Service Endpoint has an Address, a Binding, and a Contract. The Endpoint's Address is a network address where the Endpoint resides. The EndpointAddress class represents a WCF Endpoint Address. The Endpoint's Binding specifies how the Endpoint communicates with the world including things like transport protocol (e.g., TCP, HTTP), encoding (e.g., text, binary), and security requirements (e.g., SSL, SOAP message security). The Binding class represents a WCF Binding. The Endpoint's Contract specifies what the Endpoint communicates and is essentially a collection of messages organized in operations that have basic Message Exchange Patterns (MEPs) such as one-way, duplex, and request/reply. The ContractDescription class represents a WCF Contract.

A web service endpoint can hide some or all of these. And based on request can decide internally the processing of Request.

SRJTester tool (available on Github) is nice to specify Endpoint, Actions, protocols etc. while making a service request.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!