Contenido

 The component has been developed by Imola Informatica.

 

Main features

The Registry Module provides facilities for registering web services created with Roma (the Service Aspect) inside a Service Registry Repository. The registered WSDL are availble to be used as "building block" for an Enterprise Integration Mashup, as well as the textual description provided by the service developer or by the service distributor in order to be composed inside a BPEL process.

The registration of the service follows the general Roma approach: the service class is annotated, and the framework performs all the work.

The access interface to the Service Registry Repository is delegated to the specific tool: the current implementation is based on WSO2 Service Registry, which provide a web interface for human users, and a web services interface for automatic users.

The WSDL registered by using the Roma Registry Module are stored inside the WSO2 Repository, and can be accessed for mashup directly from NetBeans IDE through the WSDL Navigator. Anyway, the Registry facilities are very useful also outside the Enterprise Integration Mashup approach, since it provides a simple way to introduce governance facilities in Roma service management.

Software requirements and dependencies

Source code

The source code for the Registry Module is availbale on the SourceFroge web site, at the address:

ict-romulus.svn.sourceforge.net/viewvc/ict-romulus/trunk/ESB4Romulus/service-registry/

By using a Subversion client, you can checkout it with the following

svn co https://ict-romulus.svn.sourceforge.net/svnroot/ict-romulus/trunk/ESB4Romulus/service-registry

Get Binaries

Build it from sources

From the root folder, once having installed a Roma distribution in your environment, you must call the following ant target:

ant install

You will find the result of the building and compilation in the directory:

<ROMA_HOME>/modules/service-registry

Download

 

Tutorial

The following tutorial shows how to register the classical “HelloWorld” web service created with Roma by using the Registry Aspect.

Install WSO2 Registry

Download the binary from the wso2 site.

http://dist.wso2.org/products/registry/2.0.1/wso2registry-2.0.1.zip

For the WSO2 registry installation unzip the binary in a destination folder.

To start the service go to the WSO2 destination folder, open the bin folder and run wso2server.bat if yours current OS are Windows or wso2server.sh for Linux operating systems.

Check your WSO2 Registry instance using the URL https://localhost:9443/carbon which will take you to the WSO2 Registry Management Console.

 

 

First of all, you must create a new Roma Project (File -> New -> Project), selecting a “Web Project” type.

Then, click on “Next” button. The following dialog window will open:

 

 

Fill the “Project Name” and “Domain” fields with the name of the project and the package for the domain class.

If you press the “Finish” button, the project is created assuming the presence of the needed modules (if there are missing modules, you will have error at runtime).

So, press the “Next” button so will access to the modules selection dialog box, shown below. This box shows all the modules that are present in your Roma installation that are not added to the project.

 

 


Select “Service Registry” and “View-Echo2” modules and click “Finish”. The project is created and you can see it in the IDE.

 

Define and annotate the Domain classes

In the domain package, create the interface for the service:

package it.imolinfo.enterprise.domain;

 
public interface HelloWorld {
public String greetings(String name);
}
}
 
and the related domain implementation class:
 

public class HelloWorldImpl implements HelloWorld {

public String greetings(String name) {

   String s = "Hello " + name;

       return s;
    }
}
 

Now, annotate the class to:

  • use the Roma Service Aspect for the service creation

  • use the Registry Module to register the service.

//Mark the pojo as service:

@ServiceClass(interfaceClass = HelloWorld.class, serviceName = "Hello")

 

//Mark the pojo for the service registration it require ServiceClass Annotation

@RegistryClass(registryURI="http://192.168.2.113:9763/registry",
              username="admin",
              password="admin",

               serviceDesc="Hello Service",

               author="lacquaviva",

               organization="it.imolinfo.HelloService",

               wsdlAddress = "http://localhost:8080/RomaEcho/services/Hello")

public class HelloWorldImpl implements HelloWorld {
   ...
}
 

The service registration is performed by using the @RegistryClass annotation. The parameter to be passed are:

  • registryURI: the URL of the Service Registry where the service must be registered

  • username= the username to register the service (usually the administration, but it's not mandatory)

  • password= the username to register the service (usually the administration, but it's not mandatory)

  • serviceDesc= the service description

  • author= the author of the service

  • organization= the organization who developed or distributed the service

  • wsdlAddress = the WSDL to be registered

 

Modify the configuration files

Some configuration are needed in order to make the example working.

The first configuration concerns the file:

<PROJECT_HOME>/WebContent/WEB-INF/applicationContext-service-cxf.xml

where you must add the domain package as additional path:


...

<bean id="ServiceAspect"
class="org.romaframework.aspect.service.cxf.CxfServiceAspect" singleton="true">

 <property name="additionalPaths">

    <set>
      <value>it.imolinfo.regTest.domain</value>
    </set>
 </property>
</bean>

 

The same configuration must be done for the file

<PROJECT_HOME>/WebContent/WEB-INF/applicationContext-service-registry.xml”
 

...

<bean id="RegistryAspect" class="org.romaframework.aspect.registry.RegistryServiceAspect" singleton="true">

  <property name="additionalPaths">

    <set>

      <value>it.imolinfo.regTest.domain</value>

    </set>

  </property>

</bean>

...

 

This configuration is important to instruct Roma about where the domain classes are located.

Build the application

Build the application using the ant script. You can use directly the Eclipse IDE, right clicking on the ant build.xml file on the project folder and select the third option “Ant Build...”


Select the ant targets to execute: clean, compile and install, then click on “Run” button.

 


 

This operation will produce the war artefact for the deploy in the target application server.

 

Deploy and Test the application

To deploy the Roma application, copy the war artefact in the webapps folder of your Application Server and start the application server. During the deploy operations the application server will generate the service and register it on the remote instance of the WSO2 Service Registry (check if the WSO2 Registry service is up!).

Once the application is deployed, open the WSO2 Management console and go to the resource's page:


 

Select the “Resources” menu, and then click on the services path:

 


Open the path until you reach the WSDL registered, in this case, TestHello.wsdl:

 

 

If you click on the TestHello wsdl, the content of the file is shown and you can check if the wsdl is correct:

 


 

To view the exposed service open the browser and insert the address:

 

 

this operation will return the wsdl that describe the web service.