Service Endpoints

A host application makes a service available to client applications by providing one or more endpoints to which clients can send requests. An endpoint contains three pieces of information:

1. The address of the service. The form of a service address depends on several factors,including the transport protocol being used. Different transport mechanisms use different address spaces.

2. The binding supported by the service. The binding for a service describes how a client can connect to the service and the format of the data expected by the service.A binding can include the following information:

  • The transport protocol.This must conform to the requirements of the service address.
  • The encoding format of messages.In many cases, request and response messages will be transmitted in XML format, encoded as ordinary text. However, in some cases you might need to transmit data using a binary encoding, especially if you are transmitting images or handling streams.
  • The security requirements of the service. You can implement security at the transport level and at the message level, although different transport protocols have their own limitations and requirements.
  • The transactional requirements of the service.A service typically provides access to one or more resources. Client applications update these resources by sending requests to the service. If a client makes multiple requests of a service that result in multiple updates, it can be important to ensure that all of these updates are made permanent.
  • The reliability of communications with the service.Clients usually connect to services across a network. Networks are notoriously unreliable and can fail at any time. If a client application is performing a conversation (an ordered exchange of several messages) with a service, information about the reliability of the service is important.

3.The contract implemented by the service.A WCF service contract is an interface stored in a .NET Framework assembly and annotated with the ServiceContract attribute. The service contract describes the operations implemented by the service by tagging them with the OperationContract attribute. Any data passed to and from operations must be serializable. A service can define data contracts that describe the structure of complex data and how that data should be serialized. The service can publish the description of its service contract, which a client application can use to ascertain the operations that the service implements and to send messages that are correctly formatted.

posted @ 2011-12-16 17:30  HelloWorld.Michael  阅读(251)  评论(0编辑  收藏  举报