MSDN article
Discovery API provide a unified programming model for the dynamic publication and discovery of Web services using the WS-Discovery protocol.
A service publishes itself and the clients find published services.
A discoverable service has the abiliy to send announcement messages and respond to discovery requests.
To find a service, a client sends a Probe request, containing specific criteria (contract, keywords, network scope).
A service receiving a Probe can reply with a ProbeMatch containing the information the client needs to access the service.
A client can also send a Resolve request to find a service that has changed the endpoint address.
A service will then answer with a ResolveMatch message to the client.

The Discovery API supports two working modes: ad-hoc and managed.

Managed

A centralized server (discovery proxy) maintains information about available services. The information about services is obtain in the following modes:

  • a service sends announcement messages to the discovery proxy
  • the discovery proxy reads a database or a configuration file to determine the available services

A client uses the discovery proxy to retrieve information about available services (the Probe messages are sent to the discovery proxy).

The key principle is the discovery requests are unicast, sent only to the discovery proxy.

A client can use a well-known discovery proxy or it can send discovery probes to discover the discovery proxy. Also, the discovery proxy can send announcements during start up.

Ad-Hoc

The discovery messages are sent in multicast mode (.NET Fx uses UDP).

Benefits

  • interoperability (uses WS-Discovery protocol)
  • can easily be added to existing WCF services and clients (uses the WCF API); it is possible only the configuration files have to be updated
  • multiple transports are supported
  • the address of a service can be changed without having to reconfigure the client or the service
  • works both at run time and at design time
  • allows for fault tolerance and auto configuration.

Service Publication

To make a service discoverable, add a ServiceDiscoveryBehavior and a discovery endpoint.

Ad-Hoc discovery sample on SkyDrive
Announcement-based discovery sample on SkyDrive

Advertisements