Contenido

This component has been developed by Imola Informatica.

 

Main features

 

As described here, the Enterprise Module plays a very important role in the Romulus Enterprise Integration Mashup approach. It provides the functionalities for integrating OpenESB, the JBI Enterprise Service Bus solution from Sun, to the Roma Framework, the framework on the base of the Romulus project.

 

An Romulus EI Mashup is a composition of services that are available on the network, orchestrated by a BPEL process, which itself is exposed as a service through a WSDL interface. The ESB plays the role of resources’ homogenizer by using the Binding Components, which provide translation from the specific protocol to the ESB internal “normalized language”, and the role of integration logic holder, providing features for message transformation, service orchestration, and much more provided by the Service Engines, which may be deployed inside an ESB JBI compliant.

The Enterprise Module allows to expose on the ESB any web service created by using the Roma Service Aspect, called original service. There are two modalities for such exposition:

 
  • Simple delegation: the WSDL interface of the service is exposed on the ESB, who route the message directly to the original service, which provide the implementation. In this case, the ESB has the role of intermediary among the client and the actual service implementation, very useful in integration context.
 
  • BPEL delegation: the WSDL exposed on the ESB is associated to a BPEL process, which explicitly delegates the message to the original service. The presence of a BPEL allows the developer to explicitly implement any form of needed integration logic, before the actual call to the original service. Following the Roma approach, the module creates a BPEL project in the NetBeans IDE, so the developer find everything needed for enrich the process with the integration logic.
 
Following the Roma approach, the POJO implementing a service to be exposed on the ESB must be annotated, and the Enterprise Module will do all the work.

Software requirements and dependencies

Source code

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

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/roma-enterprise

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/roma-enterprise

Download

Tutorial

The following guide will show the main functionalities of the Roma Enterprise Module. A very simple tutorial is provided that shows how a very simple HelloWorld service, created by using Roma framework, will be exposed on the ESB (OpenESB).

Create Roma web project

First of all, you must create a Roma web application. By using the IDE4Romulus Eclipse plugin, you should go to File->New->Project. The following dialog will be open:

 

 

Choose “Roma Project” as category of project, and then choose the Web project.

Then click “Next” and a new dialog box will open:

 


Fill the “Project Name” and “Domain” fields. Then click on the Next button and go to the add module form. In the "add module" form, you can choose which modules add to your project. This dialog show all the modules installed in the current Roma Framework installation directory, that aren''''t already added to the projec (the Roma web adds some module by default).

 

 

 

 

To use the Enterprise Module functionalities, you must add the "enterprise module" to the project, as shown in the picture, and the "view-echo2" module, that will provide web services facilities. Then click "Finish", and the scaffolding for the project will be created. 

Define the Domain classes

As first step, you should create the domain classes for the service: in particular a public interface with the service methods:

 

package it.imolinfo.enterprise.domain;

 

public interface HelloWorld {

    public String greetings(String name);

}
 
and its implementation:
 

public class HelloWorldImpl implements HelloWorld {

 

  public String greetings(String name) {

      String s = "Hello " + name;
     return s;
  }
}
 

Annotate the Domain classes

 

In order to create and deploy the composite application on Open ESB or to create a new BPEL process starting from the service, we need to annotate the Domain classes.

 

// Mark the pojo as service:

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

@EnterpriseClass(
    esbHost="localhost",
    esbPort="4848",
    username="admin",
    password="adminadmin",
    consumerAddress="http://localhost:9090/Hello",
    wsdlAddress="http://localhost:8080/TestFinalEnterprise/services/Hello")
@BpelClass(consumerAddress="http://localhost:9090/Hello",
wsdlAddress="http://localhost:8080/TestFinalEnterprise/services/Hello",
projectPath="C:/")

public class HelloWorldImpl implements HelloWorld {

...
}
 

EnterpriseClass Annotation

The EnterpriseClass Annotation enables the creation of a "composite application" and its deploy inside the ESB.

@EnterpriseClass(
    esbHost="localhost",
    esbPort="4848",
    username="admin",
    password="adminadmin",
    consumerAddress="http://localhost:9090/Hello",

public class HelloWorldImpl implements HelloWorld {

...
}
 

The parameter for the annotation are the following:

  • esbHost: the host address of the ESB management console, for the remote deployment
  • esbPort: the port number of the ESB management console, for the remote deployment
  • username: the administrator username for the deployment
  • password: the administrator password for the deployment
  • consumerAddress: is the address of the service exposed over the ESB
  • wsdlAddress: is the address where the service is available without the ESB

By using the provided parameters, the Enterprise Module will be able to create the composite application and to deploy it on the ESB (OpenESB). The service will be available on its usual address (the one assigned by the Roma Service Aspect) and on the ESB, precisely on the address provided in the consumerAddress parameter.

BpelClass Annotation

Another important feature provided by the Enterprise Module address is the possibility of exporting the service attached to a BPEL process, giving the possibility to the user of associating integration logic to the service, without modification to its interface (WSDL). Some interesting examples are the invocation of other existing web services, the message transformation or initialization, and so on.

Once the service is annotated with a BpelClass annotation, a BPEL process will be created which:

  • is exposed on the ESB with the same WSDL of the originating service
  • invokes the original service
  • returns the results of this invocation

Note that the BPEL process created is not automatically deployed, as in the case described before, in order to force the developer on using this solution only in case the BPEL must contain some integration logic. In any other case, the "usual" solution without the BPEL creation is suggested. If the developer wants to use BPEL for a very simple delegation, he must:

  • create the service assembly containing the BPEL process by hand
  • create a composite application which will contain the created service assembly
  • deploy by hand the composite application on the ESB

All these operation are performed automatically in the "pure delegation" case described before, wothout any BPEL intervention.

Looking deeper in the annotation, we have:

@BpelClass(consumerAddress="http://localhost:9090/Hello",
                   wsdlAddress="http://localhost:8080/TestFinalEnterprise/services/Hello",
                   projectPath="C:/")

public class HelloWorldImpl implements HelloWorld {

...
}
 
  • consumerAddress: the address where the BPEL process will be exposed
  • wsdlAddress: the address of the original service (WSDL) to be exposed
  • projectPath: the path on the file system where the BPEL project (NetBeans BPEL project) will be saved, ready for developer''''s modification

Configuring the additional Path

Once the service has been developed and eventually exposed on the ESB (as BPEL process or not), in order to make everything working some configuration files must be modified.

The first file to be modified is In the Roma project folder, you can find the open the folder "<ProjectHome>/WebContent/WEB-INF/applicationContext-service-cxf.xml". It''''s necessary to add the package (actually the domain) where the framework can find the services, inside the <value> tags.

...
<bean id="ServiceAspect" class="org.romaframework.aspect.service.cxf.CxfServiceAspect"
      singleton="true">
  <property name="additionalPaths">
    <set>
      <value>it.imolinfo.enterprise.domain</value>
    </set>
  </property>
</bean>
 

The same modification must be performed on the file "ProjectHome>/WebContent/WEB-INF/applicationContext-module-enterprise.xml":

...
<bean id="EnterpriseAspect" class="org.romaframework.aspect.registry.RegistryServiceAspect"

singleton="true">
    <property name="additionalPaths">
        <set>
             <value>it.imolinfo.enterprise.domain</value>
        </set>
    </property>
</bean>
...
 

Build the HelloWorld application

After the configuration phase, the application must be built in order to create the archive to be deployed. 

The building phase is performed by using an Apache Ant script, that is provided by Roma framework. In the project folder, select the build.xml file, right click and select the “Ant Build...” option.

 

 

The following window will be open:

 

 

In this dialog you select the ant task to be executed: select the clean, compile and install tasks and click on Run button.

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

 

Deploy the service

 

To deploy the service, you have to deploy the Roma web application by copying the war artifact in the webapps folder of your Application Server and start the application server. During the deploy operations the application server will generate the composite application and expose it in the ESB or export the BPEL project in the destination path.

The current implementation is based on GlassFish and OpenESB, so you must start the application server by selecting the server from the service tab of the NetBeans IDE, right click and selecting start. Then, you can verify that the server is correctly started by opening the administration console, available to the address: http://localhost:4848/.

 

 

 Then, log in by using the standard administrator credentials:

  • login: admin
  • password: adminadmin

 

If you select the node JBI, and then Service Assemblies, you shold see the deployed service asssembly. In the example, the ComposedApplication3 is deployed on the server.

 

Test the application

In order to test the application, we will use the SOAP-UI tool, that provides a client to invoke the web service starting from the WSDL description.

Once open SOAP-UI and created a new project, the following window is shown:

In order to generate the client, you must insert the project name and the WSDL address: in our example a valid wsdl url is http://localhost:8080/TestEnterprise/services/Hello?wsdl, and click ok. 

This operation creates a new empty request for the service:

 

 

 

The Request must be completed with the actual data, then is sent to the service. In case of success, the response is the following: