[WSO2 Gov Registry] Using Registry API

This is also an example for how to write a web service client to authenticate and call secured admin services of a WSO2 Server.

Sometimes you need to access the registry using an external client rather than going through management console. One such use-case is that adding some external resource to the registry in deployment time. If you fully automate the deployment in the environment, you cannot do it with management console.

One another use case is automated periodic backups from the registry. There is a command-line client called registry checkin - checkout client, by which you can import and export registry as a whole. But if you need to retrieve resources in a custom way (filtered resources according to the use-case), you can leverage registry API.

There is a SOAP admin service exposed as "WSRegistryService".  There is an already written Web Service Client which can access the service and perform operations called "WSRegistryServiceClient".

Governance registry is shipped with a sample client included. You can refer the sample client under [REG_HOME]/samples/ws-client. I have extracted this project out and built a standalone project which can be found at  :


Note following:

  1. You need keystore file to communicate over SSL.
  2. You need axis2.xml to build the client context. 
  3. You need a valid username and a password to access registry. 

Use-case addressed : 

Adding a datasource by command-line was the use-case. When we place a datasource at "/_system/config/repository/components/org.wso2.carbon.ndatasource" path, it is automatically picked up as a datasource. Note that instead of

resource.setContent("Hello Out there!");

You can set the content of the datasource by file.

Hasitha Hiranya

No comments:

Post a Comment