Share via


How a DCS Client Invokes an Operation

A client application connects to a DCS service instance through a proxy object generated by the DCS Software Factory. The DCS Discovery Service lets you implement a solution that incorporates location independence for services. A client application uses the proxy to contact the Discovery Service. The Discovery Service then finds a service that implements a contract that defines the operations that the client application requested. The client application can also specify a scope to narrow the list of service endpoints retrieved. Only those service instances with scopes that match the requirements of the client are returned. The scoping mechanism lets the proxy implement transparent routing of requests to a service instance most suited to the location of the client application, and supports fallback to other service instances if connectivity to a specific service instance fails.

Advantages of Using the Discovery Service

The Discovery Service helps provide location independence for services. A client application does not have to know the address of the endpoint that it will use to communicate with a service until it actually requests a connection. The Discovery Service enables an administrator to change the location of a service without reconfiguring client applications. An administrator can also temporarily take a service instance offline to perform maintenance work. As long as another service instance that provides the same functionality is available elsewhere, client applications can continue to run.

You should understand that the Discovery Service only participates in the process for connecting a client application to a service instance. When the connection is established, the client application communicates directly with the service instance, sending requests and receiving response messages through the client proxy, and the Discovery Service plays no additional part.

The Discovery Service implements a discovery process that complies with the WS-Discovery specification. The following image shows the key elements of the discovery process. The sections that follow the illustration describe how the discovery process works.

Dd631962.d5e7d78f-664a-4bfd-8d17-12acb4ab82df(en-us,MSDN.10).png

The DCS discovery process

Note

Service discovery is optional. A client application can configure the proxy to connect to a specific service endpoint, instead of performing a WS-Discovery exchange. For more information, see Configuring a DCS Client Application.

Discovering Service Instances

When a client application connects to a service, it specifies a service contract to define the functionality of the service that it wants to communicate with, and a context that specifies the scope of the service instance that it needs to connect to. At a minimum, the client application must specify a scope that is the same hierarchical level as that of the service instance it wishes to use. For more information, see DCS Scopes. The client proxy connects to the Discovery Service and sends a Probe request. The Discovery Service examines the available services in the Discovery database for a match, and returns a Probe response that contains a list of endpoints and scopes of services that match the client application request. There might be more than one endpoint available that provides a service that meets the criteria specified by the client. The client proxy can examine the scopes of the service endpoints returned by the Discovery Service, and then direct the client application to the most appropriate instance.

Note

By default, the proxy connects the client application to the first matching service instance returned by the Discovery Service. However, you can customize how the proxy performs this task by implementing a custom scope ranker and a custom endpoint selector. For more information, see Building a Custom Scope Provider and Ranker and Building a Custom Endpoint Selector.
It is also possible to specify that a service instance can respond to connection requests that do not include a scope. In this situation, the DCS Discovery service uses the service contract definition to match the service instance to the client connection request.

Handling Service Failure

Communications between a client application and a DCS service can adapt to service failure, network issues, and other communication problems. If the DCS Discovery service identifies multiple service endpoints that can satisfy a client connection, it returns the complete list of endpoints to the client. The client proxy caches this list. If the service endpoint selected by the proxy becomes unavailable for any reason, the client proxy can work through this list of endpoints, and try to connect to a service through each endpoint until it finds a live service instance. This functionality is transparent to the client application. Because the list is cached on the client, this process requires no additional communication with the Discovery Service, unless the endpoint list is exhausted.

Note

 By default, the list of cached endpoints is retained in memory. When the client application terminates, this cache is lost. You can configure a client application to cache service endpoint information in a local SQL Server Compact Edition database on the client computer, in which case the cache is durable. The endpoint information in the cache can also be encrypted for security. For more information about how to configure the discovery cache, see Configuring a DCS Client Application.

Implementing Multiple Discovery Service Endpoints

DCS Service Pack 1 supports multiple instances of the Discovery Service. This eliminates a possible single point of failure. A client application can specify a list of discovery endpoints in the client configuration file and associate a priority with each endpoint. When the client proxy tries to contact the Discovery Service, the client channel factory can work through the list of discovery endpoints in priority order until it successfully connects to an instance of the Discovery Service.

This configuration assumes that all instances of the Discovery Service have access to the same or an equivalent copy of the Discovery database. If the client proxy uses the channel factory to contact an instance of the Discovery Service, and the Discovery Service instance does not return a matching list of endpoints for the service contract and scope, the client does not attempt to connect to another instance of the Discovery Service and try to locate the service elsewhere. Instead, it assumes that no matching instances of the specified service are available. For more information about how to configure the channel factory for a client application, see Configuring a DCS Client Application.

See Also

DCS Scopes

Configuring a DCS Client Application

Building a Custom Scope Provider and Ranker

Building a Custom Endpoint Selector