# Service Discovery (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 Admin UI

The WS-Discovery Admin UI for Carbon can be used to enable or disable WS-Discovery in server applications which hosts web services. Once WS-Discovery has been enabled in a server product, it will start publishing its service information to the specified WS-Discovery proxy. Whenever a service gets updated or undeployed, the service state information will be sent to the discovery proxy. Also when the server is shutdown, a series of status messages (BYE messages) are sent to the discovery proxy. This ensures that the information stored in the WS-Discovery proxy are in-sync with the actual staes of the services and endpoints.

If the specified WS-Discovery proxy cannot be reached for some reasons, the server will throw some exceptions, but the server along with all the deployed services will continue to function as usual. WS-Discovery does not get in the way of regular server operations.

To access the Service Discovery Admin UI select Configure > Service Discovery from the left navigation panel of the Carbon management console. The following page will be displayed.

Figure 1: Service Discovery Admin UI

## Enabling Service Discovery

To enable WS-Discovery for the server, simply enter the URL (endpoint) of the remote discovery proxy and click on "Enable". This will immediately activate service discovery mode and a series of HELLO messages will be sent to the specified discovery proxy. From here onwards all the service state updates will be communicated to the discovery proxy.

The "Discovery Proxy Status" field indicates whether the specified discovery proxy is reachable or not.

## Disabling Service Discovery

Click on the "Disable" button to stop service discovery. If you also checked the "Send BYE on Disable" checkbox, a series of BYE messages will be sent to the discovery proxy.

Figure 2: Service Discovery Admin UI (Enabled)