2009/10/11
11 Oct, 2009

Developing a simple Bpel project with eclipse Bpel Designer Plugin and WSO2 BPS Bpel Exporter Plugin

  • Chathuri Wimalasena
  • Lead analyst programmer - WSO2

This tutorial is written for eclipse 3.5 (Eclipse Galileo) and eclipse BPEL Designer plugin v. 0.4.0.

Contents

  1. Introduction
  2. Tutorial scenario
  3. Getting Started
    • Writing a simple helloworld application using eclipse BPEL Designer plugin
    • Deploying helloworld bpel in apache ODE
  4. Eclipse BPS BPEL exporter plugin
    • Deploying in WSO2 BPS



  1. Introduction
  2. Business Process Execution Language (BPEL), is an OASIS standard executable language for specifying interactions with Web Services. Processes in Business Process Execution Language export and import information by using Web Service interfaces exclusively. BPEL is an XML based Orchestration language. In an orchestration language, message exchange sequences are controlled by the orchestration designer.

    WSO2 Business Process Server (WSO2 BPS) and Apache Orchestration Director Engine(ODE) are two BPEL compliant business process executable work-flow engines, which support composition of Web services by orchestrating service interactions.

    Eclipse BPS BPEL Exporter plugin is to export a bpel project that was created by Eclipse BPEL Designer plugin. Artifact which is created from exporter plugin can be deployed in WSO2 BPS or in ODE.

  3. Tutorial Scenario
  4. Assume that you want to create a BPEL process using eclipse BPEL designer and deploy it in ODE or WSO2 BPS. This tutorial covers developing, deploying a simple helloworld BPEL application with the use of Eclipse BPEL designer and Eclipse BPS BPEL Exporter Plugin.

  5. Getting Started
  6. We assume that you have already installed following applications in your machine

    1. Java Development Kit 1.5 or above
    2. Eclipse SDK 3.5 (Eclipse Galileo)
    3. Apache Tomcat
    4. Apache ODE
    5. WSO2 BPS
    6. BPEL Designer plugin
    7. WSO2 BPS BPEL Exporter


    3.1 Write a simple helloworld application using eclipse BPEL Designer plugin

    Now lets focus on how to develop a simple helloworld application using Eclipse Bpel designer plugin.

    After successfully installing eclipse BPEL Designer Plugin, you will have the option of selecting BPEL project as you select other types of projects in eclipse environment.

    Step 1:

    Before you start step 1, please make sure you run the ODE server at least for once. If not, it may not be visible in the Target Runtime window.
    Go to new → other → Bpel 2.0 → Bpel Project and then click next.

    Give the Project Name as HelloWorld, Target Runtime as Apache Ode 1.x Runtime. If it is not already in the drop-down list, click Modify under Configuration and in the Runtimes tab you can select Apache Ode 1.x Runtime. If you still cannot find Ode runtime, click new button and you will find Apache Ode 1.x Runtime. In each case, select Bpel 2.0 facet under Project Facet of the wizard you get when you click Modify button under Configuration and click ok.

    Now the wizard will be as follows.

    Then click finish.

    Step 2:

    Now you have an empty BPEL project as “HelloWorld” in your workspace. Right click on the project, select new → other → BPEL 2.0 → New BPEL Process File and click next. Fill in the Process Details giving BPEL Process Name as “helloworld”, Namespace as https:// helloworld and select the Synchronous BPEL Process from Template and click next. Select the project that we just created (HelloWorld) and click finish.

    Your helloworld bpel process will be as follows.

    And the workspace will be as follows.

    When you select each UI component, you are able to view properties of each component by Properties window. If you cannot find properties window, go to WindowShow ViewProperties. You may need to click other if you could not find properties window in the Show View pane.

    Step 3:

    Click on recieveInput and view at the Properties window and leave them as before.

    Step 4:

    Add an Assign activity in between Receive and Reply. Expand the Palette window and click Actions option and select the Assign action. Drag and drop it in between the Receive and Reply, as shown below.

    Step 5:

    In the Assign properties window select Details tab and click New. Then in the From attribute select Variable and 'input-paylaod-input:string'. At the To attribute also select Variable and 'output-payload-result:string' as showed in the image. Save the process.


     

    3.1.1 Binding the Process

    Step 1:

    Now open the WSDL file in the Design view and add a New Service and a New Binding by right clicking on the design view. Select the Binding element in the properties window and in the General tab click Generate Binding Contents. Then you will see Binding Wizard will appear. At the Binding Details page  select the Port Type as helloworldport and Protocol as SOAP and SOAP Binding Option as document literal. Give the Binding Name as helloworldbinding.

    Step 2:

    Then select the New Service in the properties window and change the name of the service as helloworldService. Then select the NewPort and at the properties window give the name as helloworldPort, select the helloworldbinding for the Binding from the Specify Binding window. For the Address field type https://localhost:8080/ode/processes/helloworld” and select Protocol as SOAP. Now the design view of the WSDL file will be as follows.

    3.1.2 Designing Deployment Descriptor

    Step 1:

    To deploy the process in ODE, you have to create a deployment descriptor file. For that right click on the HelloWorld bpel project and go to new → other → BPEL 2.0 → Apache ODE Deployment Descriptor and click next. In the pop up wizard, check whether the correct BPEL project (i.e. HelloWorld) is selected and then click finish.

    Step 2:

    Open the deployment descriptor file (deploy.xml) in  the editor and at the Inbound Interfaces section under the Associated Port tab select helloworldport from the drop down list that will appear. Just click on the other tabs and you will see necessary details are filled automatically. Now deploy.xml will be as follows.

    Now your process is ready to be deployed in ODE. To deploy it in WSO2 BPS, you have to make it a zip file. For that Eclipse BPS BPEL plugin will be helpful.

    3.2 Deploy BPEL project in Apache ODE

    Go to Tomcat webapps directory. There you will find a directory called “ode”. If you cannot find that directory, you have to run tomcat server at least for once, after copying ode.war file into webapps directory of tomcat. Go to tomcat/webapps/ode/WEB-INF/processes directory and create a folder copying .bpel file (i.e. helloworld.bpel), .wsdl file (i.e. helloworldArtifacts.wsdl) and ODE deployment descriptor file (i.e. deploy.xml) then run tomcat server if the server is not already in started state. When you start ODE (https://localhost:8080/ode) you will see extra file with the extension .deployed will be created in tomcat/webapps/ode/WEB-INF/processes directory. In the browser go to processes link of Apache ODE homepage and you will see helloworld process has been deployed (see below image).

  7. Eclipse BPS BPEL Exporter Plugin
  8. In this tutorial we assume you have already installed Eclipse BPS BPEL Exporter Plugin in your eclipse.

    Step 1:

    Import the created BPEL project into the workspace if your workspace does not include needed BPEL  project already. This can be done by clicking file → import → General → Existing Projects into Workspace and click next.  Select the directory of BPEL project and click finish.

    Step 2:

    Right click on the BPEL project and select Export. In the Export window select WSO2 BPS Bpel Artifact under WSO2 Exporter and click next.

    Select the BPEL project and location where you want to save the created artifact and click finish.

    Now you will have the BPEL artifact that can be deployed in WSO2 BPS.


    4.1 Deploy BPEL artifact in WSO2 BPS

    Run WSO2 BPS by going to wso2bps-1.0.1/bin in the command prompt and run wso2server.sh / wso2server.bat. Go to https://localhost:9443/carbon and log as admin.  Click Add BPEL under Business Processes and browse for the path of the BPEL artifact you just created from plugin and click upload. If  there are no errors, you will get a message saying “upload successful”.  From the services list, you can check whether the uploaded artifact is there.

    You can try the service by clickng “Try this service” option.

Author

Chathuri Wimalasena, Software Engineer, WSO2, [email protected]

 

About Author

  • Chathuri Wimalasena
  • Lead analyst programmer
  • IU