Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This sample explains how to use the Governance API of WSO2 Governance Registry to create a simple webservice which is capable of looking up service endpoints. WSO2 Governance Registry contains an Apache Axis2 based runtime as a part of the WSO2 Carbon Framework. You can deploy web services on this runtime, which can be used as internal endpoints to receive notifications generated on the WSO2 Governance Registry. We will be reusing the code of the Handler Sample in this example. This sample requires Apache Maven. See Installing Apache Maven on Windows or Installing Apache Maven on Linux. This Installation Prerequisites for links on how to install it. This example also explains how to use soapUI, which is a very useful tool for testing web services.

...

2. Add the following dependency to your POM file:

Tip
Info
title

Project Object Model (POM) is an XML representation of a Maven project held in a file named pom.xml. You should find POM file by the name pom.xml inside GREG_HOME/ samples/handler/src.

...

Code Block
languagehtml/xml
<!--Fragment-Host>org.wso2.carbon.registry.core</Fragment-Host-->
Tip
Info
title

The Fragment-Host Bundle Manifest Header declares this sample bundle to be a Fragment of the Registry Kernel. This would mean that the sample handler bundle will become an extension to the Registry Kernel. However, bundles containing services.xml files would not be deployed until the Apache Axis2 runtime has been initialized. Due to OSGi bundle start-up order, it is required that the Registry Kernel starts up before the Apache Axis2 runtime.

Since the Fragment now also being an extension to the Registry Kernel, the combination of this bundle and the Registry Kernel (plus any other fragments) should start up before the Apache Axis2 runtime. But, due to the bundle not getting deployed until the Apache Axis2 runtime has been initialized, it will create a deadlock situation. Due to this reason, we have to get rid of the Fragment-Host header.

...

Code Block
mvn clean install
Note
Info
title

The command mvn clean install will trigger an Apache Maven Build in your command line. This requires you having installed Apache Maven. See Installing Apache Maven on Windows or Installing Apache Maven on LinuxSee Installation Prerequisites for links on how to install it.

A successful run of Apache Maven will generate a report similar to the following:

...

Code Block
http://localhost:9763/services/EndpointLookupService/getEndpoints?serviceName=SimpleStockQuoteService&environment=Dev
Note
Info
title

In this step, we only have passed in the parameters serviceName and environment. This sample service also supports serviceNamespace and version as optional parameters.

...