Tuesday, December 22, 2009
For more information go to WSO2 Enterprise Service Bus Eclipse Tools v1.0.0-beta product page at the oxygen tank.
Tuesday, September 8, 2009
Developing a simple Bpel project with eclipse Bpel Designer Plugin and WSO2 BPS Bpel Exporter Plugin
- Tutorial scenario
- Getting Started
- Write a simple helloworld application using eclipse BPEL Designer plugin
- Deploy helloworld bpel in apache ODE
- Eclipse BPS BPEL exporter plugin
- Deploy in WSO2 BPS
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.
2. Tutorial Scenario
Assume you want to create a BPEL process using eclipse BPEL designer and deploy it in ODE or WSO2 BPS. This tutorial covers developing, deploying simple helloworld BPEL application with the use of Eclipse BPEL designer and Eclipse BPS BPEL Exporter Plugin.3. Getting Started
We assume that you have already installed following applications in your machine
- Java Development Kit 1.5 or above
- Eclipse SDK 3.5 (Eclipse Galileo)
- Apache Tomcat
- Apache ODE
- WSO2 BPS
- BPEL Designer plugin
- 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.
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. In both cases, select Bpel 2.0 facet under Project Facet of the wizard you get when you click Modify button under Configuration and click ok. Then click finish.
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 the Process Details giving BPEL Process Name as “helloworld”, Namespace as http:// 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 can not find properties window, go to Window → Show View → Properties.
Click on recieveInput and view at the Properties window and leave them as before.
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.
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
Now open the WSDL file in the Design view and add a New Service and a New Binding by right click 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.
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 “http://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
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.
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 can not find that directory, you have to run tomcat server at least for once, after copying ode.war file in to 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 (http://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).
In this tutorial we assume you have already installed Eclipse BPS BPEL Exporter Plugin in your eclipse.
Import the created BPEL project in to 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.
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.