# WS-Discovery

Web Services Dynamic Discovery protocol (WS-Discovery) is a standard mechanism for locating services and service endpoints in a SOA. The simplest and most common scenario for WS-Discovery is a Web Services client searching for one or more target services. The protocol specification outlines two modes of operation for WS-Discovery.

- Ad-hoc mode: Uses UDP multicast to advertise and discover services
- Managed mode: Uses HTTP unicast to advertise and discover services

WSO2 Carbon provides a complete implementation of the WS-Discovery managed mode. With WS-Discovery components for WSO2 Carbon, any Carbon server can act as a WS-Discovery client, a WS-Discovery proxy or a WS-Discovery target service. Discovered services and related metadata are stored in a governance registry using governance interface of WSO2 Carbon. Therefore such information is also accessible via the service governance UI of Carbon as well.

## WS-Discovery Control Panel

The WS-Discovery Control Panel for Carbon can be used to command and control the client side aspects of WS-Discovery. It can be used to connect to remote WS-Discovery proxies and probe them for any services and service endpoints which have been already discovered. The control panel also enables you to easily convert a discovered endpoint into an address endpoint configuration which can be processed by endpoint and mediation components of WSO2 Carbon. With this feature in place one can easily construct mediation sequences and proxy services using the endpoints discovered through WS-Discovery.

To access the WS-Discovery Control Panel select Configure > WS-Discovery from the left navigation panel of the Carbon management console. The following page will be displayed.

Figure 1: WS-Discovery Control Panel (Discovery Home Page)

## Setting Up a WS-Discovery Proxy Configuration

For Carbon to be able to connect to a remote WS-Discovery proxy and make use of the endpoints discovered by the proxy, you first need to create a WS-Discovery proxy configuration. Click on Add Discovery Proxy option on the Discovery control panel. You will be taken to the Configure WS-Discovery Proxy page.

Figure 2: WS-Discovery Proxy Configuration

Specify a preferred name for the remote discovery proxy. Then specify the URL over which the remote proxy can be reached. If the remote discovery proxy is secured using WS-Security you need to first upload the client security policy to the configuration registry of Carbon and then point to it in the discovery proxy configuration page. Having entered all the required parameters click on 'Save' to save the settings to the underlying registry. You will be taken back to the WS-Discovery control panel home page, and this time you will notice the newly created WS-Discovery proxy configuration is listed there.

Figure 3: WS-Discovery Control Panel (List of Proxies)

To modify an existing WS-Discovery proxy configuration select the 'Edit' option. This will take you back to the Configure WS-Discovery Proxy page, where you can make the necessary changes to the configurations. If you want to permanently delete a proxy configuration simply select the 'Delete' option.

## Browsing Discovered Services

From the WS-Discovery control panel select the discovery proxy to which you wish to connect and click on the 'View' option. Note that you can only do this for a proxy whose status is 'On-Line'. This will send a WS-Discovery probe to the remote proxy and retrieve all the services discovered by the proxy. The retrieved information will then be displayed as follows on the Target Services and Endpoints page.

Figure 4: Target Services and Endpoints

If the remote proxy is configured to return the insactive services, they will also be displayed on the above view. You can further refine the results by the entering a search query in the 'Search by Scopes' search box. Enter either a single scope (URI) or a comma separated list of scopes to short list the result set displayed. Each search will trigger a WS-Discovery probe to the remote proxy.

To get more information on a service, simply click on the service ID in the Target Services and Endpoints page. This will take you to the target service view. You can see the exact types, scopes, endpoints and transports of the service. A WS-Discovery resolve request is sent to the discovery proxy to obtain the necessary data.

Figure 4: Target Service View

The target service view also allows you to construct mediation endpoints out of the endpoints of the target service. Such mediation endpoints can then be used in mediation sequences and proxy services. To create a mediation endpoint click and expand the Create ESB Endpoints panel. Please note that this panel will be displayed only if the endpoint UI component is installed in the Carbon server.

Figure 4: Create Endpoints Panel

Enter a name for the mediation endpoint, select a target address and click on 'Save' to create the endpoint. You can then browse to Manage > Endpoints view or Configure > Synapse view to see the newly constructed mediation endpoint and do the necessary changes to the endpoint configuration.