Web Services Discovery (WS-Discovery) is a protocol that locates web services in a network. As the name implies, the actual communication between nodes is done using web services standards (WS standards) especially in SOAP-over-UDP.
In WS-Discovery, services that are hosted in an Application server or any other service hosting environment can be exposed via a Discovery Proxy (which is default available in products like WSO2 Governance Registry), to another external Discovery client.
Example Use Case
Actual services are hosted in WSO2 Application Server (AS).
WSO2 Governance Registry (G-Reg) acts as the central repository with Discovery proxy, where all the discovered service related metadata are stored.
Discovery client would be WSO2 Enterprise Service Bus (ESB) where it consumes the discovered services and create endpoints and proxy services using them.
Two ways exist that WS-Discovery can be configured in WSO2 Carbon products.
Step 2 - Start up Discovery Proxy
Start up the G-Reg. If you access through this http://<ip_address_greg>:9765/services/DiscoveryProxy?wsdl, URL, you will observe that the Discovery proxy service is started up and running, and the service is accessible via the endpoint, http://<ip_address_greg>:9765/services/DiscoveryProxy (make a note of this endpoint URL, for the ease of usage in further steps. )
eg. http://localhost:9765/services/DiscoveryProxy
Step 3 - Configure service hosting environment
Go to $AS_HOME/repository/conf/axis2.xml and add the following parameter.
<parameter name="DiscoveryProxy">http://localhost:9765/services/DiscoveryProxy</parameter>
When we add this discovery proxy endpoint to AS, for all the existing services and new services that are getting deployed in AS, it sends a unicast hello message to the network.
Restart AS with this addition.
Go to G-Reg management console and go to Metadata --> List --> Services page. It will show up all the services that are available in AS as discovered services. If you deploy a new service in AS, that will also get reflected in the Metadata service list in G-Reg since all these services send a unicast hello messages to discovery proxy and register them selves in G-Reg.
You will notice that each and every service is assigned with a unique service name as well.
Step 4 - Configure Discovery client for 'Dynamic' mode
As mentioned above, WSO2 ESB will act as the discovery client where it can invoke the discovered services via the Endpoints and Proxy services created utilizing the Discovered services itself.
4 (a). Install the WS-Discovery Mediation Extensions feature
Start up the ESB and go to Configure --> Features. In 'Feature Management' wizard, click on 'Add Repository'. Give a name to the repo, and as the URL specify the below and click Add
eg: http://dist.wso2.org/p2/carbon/releases/3.2.0
From the populated feature list, select the following feature
WSO2 Carbon - WS-Discovery Mediation Extensions
Install it and Restart the ESB server.
4 (b). Configure the synapse registry to pick the new features
Log into ESB. Go to Manage --> Service Bus --> Source View. To the configuration, add the following two parameters.
<parameter name="discoveryProxy">http://localhost:9765/services/DiscoveryProxy</parameter>
<parameter name="extensions">org.wso2.carbon.discovery.mediation.ext.WSDiscoveryRegistryExtension</parameter>
And save the configuration. (No need to restart)
The same thing can be done from the file system as well.
Go to $ESB_HOME/repository/conf/synapse-config/registry.xml. Add the above two parameters to the file, save and restart ESB.
4 (c). Enable WS - Discovery
Log into ESB Management Console and go to Configure --> WS-Discovery. Click on "Add Discovery Proxy" link to add a new proxy. You will be directed to discovery proxy settings screen in which you can give a name for the proxy and the remote DiscoveryProxy URL (In our case http://localhost:9765/services/DiscoveryProxy).
You will be redirected to the home page of WS-Discovey Control Panel once the proxy is created. The created proxy will be listed in the control panel home page. Click on "View" to find the target services and endpoints discovered by the proxy. You will be directed to a page as shown below.
Step 5 - Create ESB Proxy etc using the Discovered Services
In the same WS-Discovery service stat page, click on a preferred service ID. It will redirected to a Service Summary page, where all the statistics regarding the particular service is listed. Also it will facilitate you to create ESB Proxy Services and ESB Endpoints using the particular service, which is very convenient in user point of view.
In WS-Discovery, services that are hosted in an Application server or any other service hosting environment can be exposed via a Discovery Proxy (which is default available in products like WSO2 Governance Registry), to another external Discovery client.
Example Use Case
Actual services are hosted in WSO2 Application Server (AS).
WSO2 Governance Registry (G-Reg) acts as the central repository with Discovery proxy, where all the discovered service related metadata are stored.
Discovery client would be WSO2 Enterprise Service Bus (ESB) where it consumes the discovered services and create endpoints and proxy services using them.
Two ways exist that WS-Discovery can be configured in WSO2 Carbon products.
- Static Discovery
- Dynamic Discovery
Static Discovery
In this aspect of WS-Discovery, the services are located and referenced via the service's actual URI. More details on Static Discovery can be read from here.
Dynamic Discovery
In service discovery, each service is obtained a unique ID (a.k.a UUID) Dynamic Service Discovery uses the uuid to refer the actual services instead of the actual URI of the hosted service.
Following the steps below will take you to a successful dynamic WS-Discovery environment set up.
Step 1 - Set up environment
Download WSO2 AS, WSO2 G-Reg and WSO2 ESB.
Step 1 - Set up environment
Download WSO2 AS, WSO2 G-Reg and WSO2 ESB.
Change the offset parameter which resides in each of the above products' $CARBON_HOME/repository/conf/carbon.xml, so that, ESB runs in port 9763, AS in 9764 and G-Reg in 9765.
eg. Open $AS_HOME/repository/conf/carbon.xml and change the offset parameter to 1.
Step 2 - Start up Discovery Proxy
Start up the G-Reg. If you access through this http://<ip_address_greg>:9765/services/DiscoveryProxy?wsdl, URL, you will observe that the Discovery proxy service is started up and running, and the service is accessible via the endpoint, http://<ip_address_greg>:9765/services/DiscoveryProxy (make a note of this endpoint URL, for the ease of usage in further steps. )
eg. http://localhost:9765/services/DiscoveryProxy
Step 3 - Configure service hosting environment
Go to $AS_HOME/repository/conf/axis2.xml and add the following parameter.
<parameter name="DiscoveryProxy">http://localhost:9765/services/DiscoveryProxy</parameter>
When we add this discovery proxy endpoint to AS, for all the existing services and new services that are getting deployed in AS, it sends a unicast hello message to the network.
Restart AS with this addition.
Go to G-Reg management console and go to Metadata --> List --> Services page. It will show up all the services that are available in AS as discovered services. If you deploy a new service in AS, that will also get reflected in the Metadata service list in G-Reg since all these services send a unicast hello messages to discovery proxy and register them selves in G-Reg.
You will notice that each and every service is assigned with a unique service name as well.
Figure 1: G-Reg Service List displays the Discovered Services |
Step 4 - Configure Discovery client for 'Dynamic' mode
As mentioned above, WSO2 ESB will act as the discovery client where it can invoke the discovered services via the Endpoints and Proxy services created utilizing the Discovered services itself.
4 (a). Install the WS-Discovery Mediation Extensions feature
Start up the ESB and go to Configure --> Features. In 'Feature Management' wizard, click on 'Add Repository'. Give a name to the repo, and as the URL specify the below and click Add
eg: http://dist.wso2.org/p2/carbon/releases/3.2.0
From the populated feature list, select the following feature
WSO2 Carbon - WS-Discovery Mediation Extensions
Install it and Restart the ESB server.
4 (b). Configure the synapse registry to pick the new features
Log into ESB. Go to Manage --> Service Bus --> Source View. To the configuration, add the following two parameters.
<parameter name="discoveryProxy">http://localhost:9765/services/DiscoveryProxy</parameter>
<parameter name="extensions">org.wso2.carbon.discovery.mediation.ext.WSDiscoveryRegistryExtension</parameter>
And save the configuration. (No need to restart)
The same thing can be done from the file system as well.
Go to $ESB_HOME/repository/conf/synapse-config/registry.xml. Add the above two parameters to the file, save and restart ESB.
4 (c). Enable WS - Discovery
Log into ESB Management Console and go to Configure --> WS-Discovery. Click on "Add Discovery Proxy" link to add a new proxy. You will be directed to discovery proxy settings screen in which you can give a name for the proxy and the remote DiscoveryProxy URL (In our case http://localhost:9765/services/DiscoveryProxy).
Figure 2: Discovery Proxy Configure page in ESB |
You will be redirected to the home page of WS-Discovey Control Panel once the proxy is created. The created proxy will be listed in the control panel home page. Click on "View" to find the target services and endpoints discovered by the proxy. You will be directed to a page as shown below.
Figure 3: ESB displays Dynamically discovered services |
Step 5 - Create ESB Proxy etc using the Discovered Services
In the same WS-Discovery service stat page, click on a preferred service ID. It will redirected to a Service Summary page, where all the statistics regarding the particular service is listed. Also it will facilitate you to create ESB Proxy Services and ESB Endpoints using the particular service, which is very convenient in user point of view.
Figure 4: Create EPs, Proxies using Discovered Services |
No comments:
Post a Comment