Access WSO2 Governance as a Service From Remote Registry

WSO2 Governance as a Service is a hosted instance of WSO2 Governance Registry with multi-tenant support. WSO2 Governance as a Service provide you almost all the functionalities provided with the Governance Registry targeting the enterprise SOA governance, same time it provides all the advantages  inherent with the Software as a Service model.

Here I’m talking about how to use a popular feature available in Governance Registry, inside WSO2 Governance as a Service. i.e. Remote Registry Client. With Remote Registry Client, you can access the resources in registry programatically. It uses atom/pub protocol to communicate with the registry server.

Here is an example of using Remote Registry Client. I assumed I have an account with domain name ‘’ with a user name ‘example_user’ (‘example_password’). You have to change this to valid values before running this code, You can create an account in Governance as a Service freely for a limited use.

import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.Resource;

class RegistryDemo {
    public static void main(String[] args) throws Exception {

        // calls the registry with the authentication information
                   "", "example_password");

    public static void callRemoteRegistry(String url, String username,
                       String password) throws Exception {

        Registry myRegistry = new RemoteRegistry(new URL(url), username, password);
        if (!myRegistry.resourceExists("/demoResource")) {

            Resource r = myRegistry.newResource();
            r.setContent("demo content");
            myRegistry.put("/demoResource", r);

        Resource r = myRegistry.get("/demoResource");
        byte[] contentBytes = (byte[])r.getContent();
        String content = new String(contentBytes);
        System.out.println("Content: " + content);
This entry was posted in Cloud, GaaS, Governance, Governance Registry, SOA, wso2 and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *