Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

...

Open the Developer Studio Dashboard by clicking on Open Dashboard option under top menu item Developer Studio.

New Server Runtime

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

Select Import Data Service and click Next.

New Server RuntimeImage Modified

Browse for the Data Services Descriptor file, CustomerDS.dbs under $DOWNLOAD_HOME/banking-sample/ds/dbs and click Finish.

New Server RuntimeImage Modified

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

New Server Runtime

...

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

New Server RuntimeImage Modified

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

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

New Server RuntimeImage Modified

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

New Server RuntimeImage Modified

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 Modified

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

  <
  transports
  >
    <
  transport
  >jms</
  transport
  >
</
  transports
  >

Now your services.xml will look like below.

New Server RuntimeImage Modified

Now we are done with modeling Account Service.

...

  • Project Name - CardAxis2Service
  • Package Name - org.wso2.sample
  • Class Name - CardAxis2Service

New Server RuntimeImage Modified

Now you will see the CardAxis2Service has been created in the workspace. Now copy the original sources CardAxis2Service.java, Customer.java and Card.java from $DOWNLOAD_HOME/banking-sample/appserver/CardApplication/src/main/java/org/wso2/sample and paste in to org.wso2.sample package of the CardAxis2Service project. Now we are done with creating two mock services and we are ready to deploy those two services in to WSO2 Application Server.

Before deploying the services to Application Server, we need to create a Carbon Composite Application Project to group the two created axis2 services.

3. Create a Carbon Composite Application Project to group mock objects

Open Developer Studio Dashboard again and select Carbon Composite Application Project.

Give a name to the Carbon Composite Application Project and select both services that we created. New Server RuntimeImage Removed

Image Added
 

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

New Server RuntimeImage Modified

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

...

Once you add the server successfully, start the server and add BankingSample Carbon Composite Application to the running server.

New Server RuntimeImage Modified

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

...

If you check on other service CardAxis2Service, you will see both HTTP and JMS transport endpoints are available.

 

Now we are going to create proxy services to abstract the above two services.

...

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

Image Added 

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

...

Make sure the correct endpoint is being referenced. Expand AccountService -> InSequence -> Anonymous -> Send and click on the Endpoint below it. In  In the Properties window below, select the row with the Endpoint on it, then click on the button on the far right containing ellipsis (...). New Server RuntimeImage Removed

Image Added

In the Resource Key Editor that pops up, select workspace. New Server RuntimeImage Removed

Image Added
 

Expand Carbon Application Endpoints and ESB Configuration Project , then select MainframeEP . New Server RuntimeImage Removed

  Image Added

Save the proxy service and now we complete the proxy service that wrap the AccountService mock object.

...

In the same manner, 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 Modified

Once the endpoint has been created, make sure that the correct URI has been specified. New Server RuntimeImage Removed

Image Added

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

Right click on the ESB Configuration Project and select New->Proxy Service. Select Create A New Proxy Service and click Next.

New Server RuntimeImage Modified

Give the name as CardService and select Custom Proxy from Proxy Service Type and click Finish.

New Server RuntimeImage Modified

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 five two top level nodes as WSDL, InSequence, Endpoint, OutSequence and FaultSequence.Select WSDL, then in ; InSequence and OutSequence.

In the Properties window below, select the row corresponding to WSDL Type, and change its value from None to Specify source URI and NONE to SOURCE_URL and hit Enter. Now a new row will open up with the name WSDL Wsdl URL. New Server RuntimeImage Removed

Image Added

In this field, we specify the actual file location of the WSDL file as file URI. The file CardService.wsdl can be found at $DOWNLOAD_HOME/banking-sample/appserver.Your file URI will be similar to: file:///$DOWNLOAD_HOME/banking-sample/appserver/CardService.wsdl . New Server RuntimeImage Removed

Select InSequence -> Anonymous, right-click on Anonymous and select New child -> Transform -> XSLT.
New Server RuntimeImage RemovedImage Added

Drag and drop the XSLT mediator from the tool palette.

Image Added

Click on the newly created XSLT node, and in the Properties window below, enter the value change the Schema Key value to conf:/transform/transform.xslt against Schema Key. New Server RuntimeImage Removed

Image Added
 

This means that the transformation stylesheet is to be found in the local registry. But we don't have it there yet. The XSLT stylesheet used for transformation (transform.xslt) now needs to be imported into the local registry.
New Server RuntimeImage Removed

We will create the Registry Resource in the next step. Before that, we will complete the proxy service assuming that the Registry Resource is being there.

You can create before and after logging elements under CardService -> InSequence -> Anonymous by right-clicking on Anonymous and selecting New Child -> Core -> Log. Move one of them above XSLT and the other below. For each of them, create a Property by right-clicking on the Log element and selecting New Child -> Log Property.Add a Send mediator to point to cardServiceEP that we have created earlier. To add Send mediator, right click on Anonymous and select New Child -> Core -> Send.
New Server RuntimeImage RemovedRight click on the Send mediator and select New Child -> Endpoint Reference (Registry).
New Server RuntimeImage RemovedNow go to Properties view and open Resource Key Editor and click the workspace link.
New Server RuntimeImage RemovedChoose cardServiceEP and click OK.
New Server RuntimeImage Removed

Ensure that in the Design window, CardService -> OutSequence -> Anonymous has an element called Send under it.

Now your CardService will look like this.
New Server RuntimeImage RemovedNow we by dragging the Log mediator from the tool palette to before and after the XSLT.

Image Added

Drag and drop a Send mediator and then drag and drop the cardServiceEP that we created earlier from the defined endpoints.

Image Added

Now add a Send mediator as an OutSequence. We have successfully completed creating the proxy service for the card system.

Image Added

Create Registry Resource for transform.xslt

...

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

New Server RuntimeImage Modified

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 Modified

Give necessary information for the Registry Resource Project and click Finish.

New Server RuntimeImage Modified

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 Modified

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

...

Select Create New BPEL Workflow and click Next.

New Server RuntimeImage Modified

Give Project Name and Process Name as AccountOpeningProcess and leave the other fields as default values. Then click Finish.

New Server RuntimeImage Modified

Now you will see that new BPEL Workflow has been created in the workspace.

New Server Runtime

...