Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

This page walks you through the development of a complete sample application. It includes the following sections:

...

The following diagram shows how these components hang together. New Server RuntimeImage Removed

Image Added

Prerequisites

Now we are going to implement the solution using WSO2 Developer Studio. Before start implementing, you will need following third party tools and WSO2 Products.

Third Party Tools

...

  • ActiveMQ
    • activemq-core-5.4.2.jar (in ActiveMQ version 5.8.0 and above, activemq-core-5.8.0.jar has been split into activemq-broker-5.8.0.jar and activemq-client-5.8.0.jar)
    • geronimo-j2ee-management_1.1_spec-1.0.1.jar
    • geronimo-jms_1.1_spec-1.1.1.jar
  • MySQL JDBC Driver
    • mysql-connector-java-5.1.13-bin.jar

...

Following is the logical solution diagram that we are going to use while implementing the solution. This diagram shows how each and every WSO2 Product incorparate to come up with end to end solution.

Image Added
New Server RuntimeImage Removed  

In this sample, we are going to create seven projects for each and every component.

...

  • WSO2 App Server - 0 (App Server will now listen on 9764 9763 and 94449443)
  • WSO2 ESB - 1 (ESB will now listen on 9764 and 9444)
  • WSO2 BPS - 2 (Business Process Server will now listen on 9765 and 9445)
  • WSO2 DSS - 6 (Data Services Server will now listen on 9769 and 9449)

...

Enable the ESB to talk over a message queue

Copy the ActiveMQ libraries (activemq-core-5.4.2.jar, geronimo-j2ee-management_1.1_spec-1.0.1.jar and geronimo-jms_1.1_spec-1.1.1.jar) to the App Server ESB ($ESB_HOME/repository/components/lib).

Enable the JMS transport on the ESB

Follow the same step that we did for App Server in the previous step.

...

Set up Customer Data Service

Open Under the Developer Studio Dashboard by clicking Open Dashboard under top menu item Developer Studio.
New Server RuntimeImage Removed
 top menu item, click Open Dashboard to open the Developer Studio Dashboard.  

To create a Data Service, click Data Service Project under the Data Services Server category.

Select Import Data Service and click Next.

Image Added
New Server RuntimeImage Removed  
Browse for the Data Services Descriptor file, CustomerDS.dbs under $DOWNLOAD_HOME/banking-sample/ds/dbs and click Finish.

New Server RuntimeImage Removed Image Added

Now you will see that the Data Service Project has been created in the workspace. Make sure to change the User Name and Password according to your MySQL credentials. New Server RuntimeImage Removed

Image Added

Anchor
SetUpMockObjectsMainframeCardSys
SetUpMockObjectsMainframeCardSys

...

From the Axis2 Service Creation Wizard, select Create New Axis2 Service and click Next. New Server RuntimeImage Removed

Image Added
Fill the following information for Project Name, Package Name and Class Name.

  • Project Name - MainframePojoService
  • Package Name - wso2.hcc
  • Class Name - MainframePojoService 

After giving the necessary details, click Finish. Now you can see that the Axis2 Service has been created in the workspace. New Server RuntimeImage Removed

Image Added
Now copy the two source files MainframePojoService.java and Account.java from $DOWNLOAD_HOME/banking-sample/appserver/AccountService/src/wso2/hcc and paste into the wso2.hcc package in the MainframePojoService project. New Server RuntimeImage Removed

Image Added

Now we want to enable JMS transport, since this service will communicate via JMS transport. To enable this, we need to add the following block to services.xml under /src/main/resources/META-INF.

...

Now your services.xml will look like below. New Server RuntimeImage Removed

Image Added
Now we are done with modelling the Account Service.

2. Modeling Card System

Now we want to create the Card System. This will be another Apache Axis2 Service Project. Click Axis2 Service Project from the WSO2 Developer Studio Dashboard as you did in the previous step.

...

You will see that the Composite Application Project has been created in the workspace with the name you have specified.

New Server RuntimeImage RemovedImage Added

4. Deploy the Composite Application Project in to WSO2 App Server

...

Once you add the server successfully, start the server and add the BankingSample Composite Application to the running server. New Server RuntimeImage Removed

Image Added
Wait till the application gets deployed successfully to the server. Once the deployement deployment is completed, you will see logs similar to the following in the Eclipse Console.

Code Block
languagenone
[2012-04-20 10:05:57,818] INFO {org.wso2.carbon.application.deployer.internal.ApplicationManager} - Deploying Carbon Application : BankingSample.car... 

[2012-04-20 10:05:58,059] INFO {org.wso2.carbon.application.deployer.internal.ApplicationManager} - Successfully Deployed Carbon Application : BankingSample {super-tenant} 

[2012-04-20 10:06:07,881] INFO {org.wso2.carbon.core.deployment.DeploymentInterceptor} - Deploying Axis2 service: MainframePojoService {super-tenant} 

[2012-04-20 10:06:10,517] INFO {org.apache.axis2.transport.jms.ServiceTaskManager} - Task manager for service : MainframePojoService [re-]initialized 

[2012-04-20 10:06:11,528] INFO {org.apache.axis2.transport.jms.JMSListener} - Started to listen on destination : MainframePojoService of type queue for service 
MainframePojoService 

[2012-04-20 10:06:11,570] INFO {org.apache.axis2.deployment.DeploymentEngine} - Deploying Web service: MainframePojoService-1.0.0.aar - file:/media/dev/CS-Resources/2.0.0/review-02-04-2012/servers/wso2as-4.1.2/repository/deployment/server/axis2services/MainframePojoService-1.0.0.aar
 
[2012-04-20 10:06:11,605] INFO {org.wso2.carbon.core.deployment.DeploymentInterceptor} - Deploying Axis2 service: CardAxis2Service {super-tenant} 

[2012-04-20 10:06:12,224] INFO {org.apache.axis2.transport.jms.ServiceTaskManager} - Task manager for service : CardAxis2Service [re-]initialized 
 
[2012-04-20 10:06:13,233] INFO {org.apache.axis2.transport.jms.JMSListener} - Started to listen on destination : CardAxis2Service of type queue for service 
CardAxis2Service 

[2012-04-20 10:06:13,234] INFO {org.apache.axis2.deployment.DeploymentEngine} - Deploying Web service: CardAxis2Service-1.0.0.aar - file:/media/dev/CS-Resources/2.0.0/review-02-04-2012/servers/wso2as-4.1.2/repository/deployment/server/axis2services/CardAxis2Service-1.0.0.aar

...

To create an ESB Config Project, click on Create New Project link. New Server RuntimeImage Removed

Image Added
Give a name to the ESB Config Project and click Finish. New Server RuntimeImage Removed

 Image Added

Now you will see that the created ESB Project is set in the Save endpoint in field. New Server RuntimeImage Removed

Image Added
Now you will see that the endpoint has been created inside the ESB Project that you have created. Once you double click on the MainFrameEP node, you will see that the Properties view gets focused. You need to update the URI field with the correct JMS URI that appears in the App Server after deploying the two mock services.

 

Save the configuration and now we are done with the address endpoint.

...

Right-click on the ESB Configuration Project, then select New ->Proxy Service. Choose the second radio button Import Proxy Service and click Next. Browse to $DOWNLOAD_HOME/banking-sample/esb/synapse-configs/default/proxy-services and select AccountServiceProxy.xml and click Finish. New Server RuntimeImage Removed

Image Added
Make sure the correct endpoint is being referenced. In the Properties window below, select the row with the Endpoint on it, then click on the button on the far right containing ellipsis (…).

In the Resource Key Editor that pops up, select click workspace.


 
Expand   Carbon Application Endpoints   and   ESB Configuration Project   , then select   MainframeEP   .

...

1. Create an "address endpoint" for the CardService on the ESB

In the same manner , that you create the MainFrameEP, create the cardServiceEP. Resource file for cardServiceEP can be found at $DOWNLOAD_HOME/banking-sample/esb/synapse-configs/default/endpoints New Server RuntimeImage Removed

Image Added
Once the endpoint has been created, make sure that the correct URI has been specified.

2. Create a service on the ESB that will act as a proxy to the Cards system

...

Give the name as CardService and select Custom Proxy from Proxy Service Type and click Finish. New Server RuntimeImage Removed

Image Added
Now you will find a basic template for a custom proxy has been created in the workspace. Next we have to configure it according to our scenario.

Once the CardService has been opened in Design view, you will see that there are three basic sections in the proxy service; InSequence, OutSequence and FaultSequence (red rectangle).

...

Select Import from file system and click Next. New Server RuntimeImage Removed

Image Added
Click Browse and browse for the transform.xslt file at $DOWNLOAD_HOME/banking-sample/esb/cardService.

Set Registry path to deploy as /_system/config/transform. Note that this is the same path we set when creating CardService. New Server RuntimeImage Removed

Image Added
With WSO2 Developer Studio, we create all the Registry Resources in a project type called Registry Resources Project. If your workspace has already created Registry Resources Projects, you can point one of them to save your registry resource.

If you do not have created Registry Resources Project, you will have to create a Registry Resource Project in order to create the Registry Resource. To create a Registry Resource Project, click on the link Create New Project.... New Server RuntimeImage Removed

Image Added
Give the necessary information for the Registry Resource Project and click Finish. New Server RuntimeImage Removed

Image Added

Now you can see that the created Registry Resources Project is set in the Save resource in field. Once you fill all the information, click Finish. New Server RuntimeImage Removed

Image Added
Now you will see that the new Registry Resources Project has been created in the workspace.

We have successfully completed the two proxy services for the mock services.

...

You will see that the new BPEL Workflow has been created in the workspace. New Server RuntimeImage Removed

Image Added
Note that this is just a template BPEL. We need to create the process file according to our scenario. If you are familiar with BPEL, you can use the graphical editor to drag and drop necessary elements from the palette.

For this scenario, you can find already developed BPEL file and other WSDL files from $DOWNLOAD_HOME/banking-sample/bps/AccountOpeningProcess.

Copy all the files from that location and paste in to AccountOpeningProcess project. New Server RuntimeImage Removed

Image Added
Now we have successfully completed all the parts that we need to try the scenario.

Deploy the SOA Integration Solution

...

Open the pom.xml under Banking Sample. If it is already opened, you will have to refresh the file in order to view all the artifacts in the design view. New Server RuntimeImage Removed

Image Added
Select all the artifacts by clicking the Select All button. Now we want to change the server role of the Registry Resource from Governance Registry to Enterprise Service Bus since we need to deploy the XSLT file in to local registry of the WSO2 ESB. New Server RuntimeImage Removed

 Image Added

Now we are ready to create the CAR file from the BankingSample C-App project.

To create the CAR file, click on the Create Archive button at the right hand corner of the design view of the pom.xml. You can achieve the same option by right click -clicking on the BankingSample C-App project and select selecting Export Composite Application Project.
New Server RuntimeImage Removed 

Specify the location you want to save the CAR file. Now you will see that the BankingSample.car file has been created in the given location and you can deploy this CAR file in to WSO2 Servers.

Testing the Working Solution

...

Once you click this link, you will be prompted to select the CAR file you have saved to your file system. Upload it, then watch the console for messages that the CAR file has been deployed and the appropriate services have also been deployed. New Server RuntimeImage Removed

Image Added
You will find the following artifacts in different servers once you deploy the CAR file to all the servers. The application BankingSample should be listed in all the servers as well.

ServerDeployed Artifacts
WSO2 App ServerMainframePojoService, CardAxis2Service
WSO2 ESBMainFrameEP, cardServiceEP, AccountServiceProxy, CardService, transform.xslt
WSO2 DSSCustomerDS
WSO2 BPSAccountOpeningProcess

...