The operations of the WSO2 Governance Registry can now be accessed through Web Service calls using the Web Service API (WS-API).
The WS-API supports almost all operations exposed through the main Registry API. A WS client is provided for the WS-API which allows you to access the Registry just as you would through the main Registry API.
Setting up the WS API Registry Client and WS-Security
The following code shows how to set up the WS Client and authenticate it against an instance of the Governance Registry.
It is assumed that default configurations of the Registry have not been changed.
1. Set the system properties to enable the HTTPS connection.
2. A number of parameters are required to initialize the client. These are initialized in the following code:
3. The final steps of the initialization is done in the following code segment:
4. Run an
ant command at
GREG_HOME/bin and add all the JARs created in
GREG_HOME/repository/lib to the class path prior to running the examples.
5. If you run this example, an output similar to the following output will be generated at the server side console.
6. This client instance can now be used just as using the Registry API.
7. Set up WS-Security for the WS-API. To add WS-Security for the WS-API, just name the relevant policy file as
ws-api-sec-policy.xml and place it into
GREG_HOME/repository/conf. WS-Security will now be engaged.
Here are some of the possible operations as examples.
Adding a Resource to the Registry
Commenting, Tagging and Rating a Resource
Moving and Renaming a Resource
Retrieving the Resource's Content
This will output the original content to the console, for example, "R1 content."
See more operation in Registry API.