Thursday, April 28, 2016

[Sample] Order Processing Process

This sample illustrates usage of WS-BPEL 2.0, WS-HumanTask 1.1 and Rule capabilities in WSO2 Business Process Server and WSO2 Business Rule Server.


Order Processing Flow
alt text
  • The client place an order by providing client ID, item IDs, quantity, shipping address and shipping city.
  • Then Process submits order information to invoicing web service, which generates order ID and calculate total order value.
  • If total order value is greater than USD 500, process requires a human interaction to proceed. When a order requires a human interaction process creates a Review HumanTask for regional clerks. If review task is rejected by one of regional clerk user, workflow terminates after notifying the client.
  • Once the regional clerk approve the review task, workflow invokes Warehouse Locater rule service to calculate nearest warehouse.
  • Once receiving nearest warehouse, process invokes Place Order web service to finalize the order.
  • Finally user will be notified with the estimated delivery date.

This sample contains

Please checkout this sample from Github. 

Monday, January 11, 2016

[WSO2BPS] Hello World BPMN 2.0 Process


This tutorial will explain,
  • How to create a Hello World BPMN process using wso2 developer studio and Activiti eclipse designer.
  • Try Hello World BPMN process using WSO2 Business Process Server.

Prerequisites



Steps


Creating Hello World BPMN Process and Hello World Service Task

1) In Eclipse, Create an Activiti Project.





2) Create an Activiti Diagram (a BPMN process)





3) Create following process by adding Start event, Service Task and End Event. Link each activity as shown below.



4) Create a Java project for HelloWorld Service Task.





5) Add activiti-all_5.19.0.wso2v2.jar ( or Later version ) to project build path as an external Jar. You can find this jar from /repository/components/plugins/activiti-all_5.19.0.wso2v2.jar.



6) Create a Java package called "org.wso2.bpmn.helloworld.v1"





7) Create Java Class for HelloWorld Service task implementation.



8) Add org.activiti.engine.delegate.JavaDelegate interface to your class.



9) Implement HelloWorld Service Task business logic.




10) Configure HelloWorld Service Task Class name in properties.



Best Practices :
  • When you create a Java Service Task, version your java package or classes by adding version number into Java Package path or Class name.
  • This is useful when you have multiple versions of same workflow and changing Service task business logic in each process version.

For example.

HelloWorld Process Version 1 - Service Task implementation.

HelloWorld Process Version 2 - Service Task implementation.



  • This will avoid affecting new or running process instances which are created from old process version, because of business logic change in service tasks.


Creating Deployment Artifacts


11) Create WSO2 Java Library project.





12 ) Add HelloWorldServiceTask Java project from workspace.



13 ) Create Composite Application Project.



14 ) Select HelloWorldServiceTask_Artifact as a dependency.



15 ) Select Business Process Server as HelloWorldServiceTask_Artifact's server role.



16) Export Capp.



17) Select Activiti Diagram and Export as an Archive file.




18) Rename file extension as ".bar". Select "Create Only Selected directories." Then Export.




19) Deploy Car file in WSO2 BPS server.



After successful deployment, you will see following logs, in console.




INFO {org.wso2.carbon.application.deployer.handler.DefaultAppDeployer} - OSGi bundle HelloWorldServiceTask_Artifact installed to Carbon Server.
INFO {org.wso2.carbon.application.deployer.handler.DefaultAppDeployer} - OSGi bundle HelloWorldServiceTask_Artifact successfully started on Carbon Server.

20) Deploy HelloWorld.bar file



21 ) Login to BPMN-explorer (eg: https://localhost:9443/bpmn-explorer) ( admin/admin is default admin user credentials.). Start Hello World Process.





22 ) In console you will see "Hello World …!!!" string is printed.

Saturday, November 28, 2015

[WSO2BPS] Uploading a BPEL archive using admin services


Some users want to automate BPEL deployment using external tools. This blog post discuss how you can use BPEL Uploader admin service for this purpose.

Applies to WSO2 BPS 3.x. ( Tested on 3.2.0 )

Viewing wsdl of BPEL Uploader admin service

  1. Change "HideAdminServiceWSDLs" to false in Carbon.xml.
  2. (Re)Start WSO2 BPS server. 
  3. Now you can view BPEL uploader admin service WSDL from 
    • https://localhost:9443/services/BPELUploader?wsdl

Method 1 - Using SOAP UI. 


Create SOAP UI project using "https://localhost:9443/services/BPELUploader?wsdl"



  1. Open upload service request and add an attachment using Attachment tab.
  2. Select your BPEL file from file system. ( eg: Async-Client.zip )
  3. Give File Name in SOAP request  ( Async-Client.zip )
  4. Type "cid:Myzip-File" in dataHandler.
  5. Select Myzip-File in Part column in attachment tab. 
  6. In Auth tab. Configure Basic authentication ( Usernname/passowrd admin/admin - Authenticate Pre-Emptively)
Now you will able to upload BPEL file using SOAP UI. 

Note: When you send above request, SOAP UI automatically replace dataHandler content with base64 encoded content of zip file. 


Method 2 - Using Curl Command line tool.

  1. First Convert zip file content into base64 format. For that use base64 command line tool as follows,

  2. $ base64 Async-Client.zip > base64.txt

  3. Create request.xml file with following content. Replace dataHandler text with content of base64.txt


  4. Use following curl command to upload your BPEL file. 

curl --user admin:admin -k -s -v --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction: urn:uploadService" --data @request.xml https://localhost:9443/services/BPELUploader 


-- End --