Showing posts with label BPEL. Show all posts
Showing posts with label BPEL. Show all posts

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, October 20, 2014

Book Review : WS-BPEL 2.0 Beginners Guide

WS-BPEL 2.0 Beginners Guide: As name suggest, This is a good reading for who wants to learn BPEL concepts from beginning. Authors start book with a very simple BPEL sample. They give details instructions from setting up IDE, creating schema and wsdl, etc. They finish their first sample giving instructions to how you can test your first BPEL process using a BPEL engine. That is why I recommend this book as a true beginner guide.

BPEL specifications is so long and even BPEL 2.0 primer is very hard to understand without prior knowledge on BPEL. But authors have structured book chapters from simple to complex BPEL concepts, so that beginners can easily understand. It contains chapters for fault handling, compensation, parallel processing  asynchronous invocation etc. Best part is authors have given samples for each section including guidance how you can do it in IDE.

This book contains special chapter for Humantask with samples. That adds a true value to this book.

Even BPEL 2.0 is published in 2007, (Nearly 7 years ago) it is usage is increasing in enterprise world. It is an widely used industrial standard for Business process management (BPM). I think knowing BPEL is an added advantage for a programmer, architect and students; and this is the best book to start with.

Have a look on this book by clicking this link.

Saturday, May 17, 2014

Java4BPEL - Java Class extension activity for WSO2 BPS


java4bpel

java4bpel is an extension for Apache ODE and WSO2 BPS. java4bpel introduces new BPEL extension activity called invokeClass, which can be used to invoke a JAVA class.

Project home page

Project git location
Clone project from 
https://github.com/hasithaa/java4bpel.git

Sunday, May 4, 2014

An Async BPEL Process and A Human task ?

In Async process ( in other words a long running process ), after the invocation of a partner process or service, the BPEL process continues to carry on with its execution process while that partner service completes performing its operation. This partner service may take couple of seconds, minutes, hours or even days to complete. The Async BPEL process then receives the result of the partner service via a callback service, when the partner service is completed.

HumanTask (Web service) is one type of such a long running partner service which returns the task result when user completes the task. In this case, BPEL use B4P extension, which stops the BPEL execution flow which contains the B4P extension activity and waits till HumanTask output to come.

Friday, March 28, 2014

Recovering BPEL Activity Failures - WSO2 BPS


Read more about ODE activity failure and recovery from.

 

Method 1: Via WSO2 BPS Management Console 


In WSO2 BPS, BPEL failed activity recovery can be done using WSO2 BPS Management console.

To do this, it is required to enable ODE activityLifecycle events for a BPEL process. To do that modify process-event configuration in deploy.xml as follow.
(refer http://ode.apache.org/ode-execution-events.html for to see how you can enable ODE events for a BPEL process.)

Users can view activity failures for a BPEL process instance in the instance view page. 

1) Goto Instances -> click on of the instance ID to open the instance view for that instance.


 2) In the instance view, you can find failed activity/activities under activity informations. (See image). Also you can retry/cancel (ignore a failed activity) a failed activity using two buttons listed under Action column.





Method 2 - Via InstanceManagementService admin API



Also users can recover failed activities by using BPS InstanceManagementService. Unfortunately there is no UI functionality for this when ode events are disabled. (BPS 3.2.0 & older)


These are the steps, to retry activities using InstanceManagementService admin service.

1) Execute following SQL query on BPS database.

This will return the failed activities with corresponding BPEL process instance id. You will require following information to retry a failed activity.
  • INSTANCE_ID
  • ACTIVITY_ID

2) Set HideAdminServiceWSDLs configuration to false in /repository/conf/carbon.xml file.

eg:

3) Then start the BPS server.


4) Now create a SOAP-UI project using https://localhost:9443/services/InstanceManagementService?wsdl


5) Create a new request under recoverActivity operation. A sample request will be like this.


6) Then Authenticate soap-ui request by configuring authentication and security related settings.
For Basic Auth select Authorization type as preemptive, and give admin user name and password.

7) Then for each failed activity (results in step 1), send a recoverActivity request. Use "retry" action to retry activity, and use "cancel" action to cancel the activity retry and continue instance execution.



Tuesday, August 20, 2013

Working with SOAP Headers in BPEL - WSO2 BPS / Apache ODE


Most of the web services use soap headers to pass various kinds of information and it is required to manipulate those headers within a BPEL process when we are creating a complex business logic. Sometimes we have to deal with soap headers which aren't declared in the WSDL abstract message. These kind of headers are called Dynamic headers and both Apache ODE and WSO2 BPS can handle these type of soap headers.

For more information about header handling in Apache ODE, follow this article.

This post will show you how to handle soap headers, covering following scenarios,

  1. Reading a soap header in request message.
  2. Create a new soap header in a variable and assign a value to it.
  3. Copying soap header from one variable to another.  

Sample BPEL Process

To demonstrate above scenarios let's consider this simple BPEL process. These are process's default request and response messages.


1. Reading SOAP Header in Request Message.

Let's read "echo" header from the input message and set its value into the process output message (to result element). To do this, add another copy into the Assign activity like this. Note that we are using "header" attribute to refer a soap header. (Resultant process's response is shown in response.xml)


2. Create a new soap Header in a variable and assign a value to it

Let's add new soap header called "echo2" in the output variable and assign request message text (input) value as new header value. First copy will create the echo2 header and second copy will do the value assigning. (Resultant response is shown in response.xml)

3. Copying soap header from one variable to another.  

Let's copy request message's echo header to output message. In the Assign activity define a copy as follow. (Resultant response is shown in response.xml)

Saturday, May 25, 2013

Escalating a human task with WSO2 BPS.

This Post describes, how to you can define a deadline within a human task. For this I am going to extend WSO2 BPS Claim Approval Task sample.

Prerequisite

  • If you haven't tried the sample yet, try it first. So you get better idea about how human task works.
  • Download WSO2 BPS 3.0.0 +
  • an Text Editor.

Note: You can find more information about humantask deadlines and timeouts under section 4.9 in humatask specification. 

What I am going to do in this sample ...

In this sample, I have set deadline time duration for 5 minuets after task creation. The escalation is defined such a way that, if the claimed amount is less than 10000 and task not started within 5 minutes, then notify task's potential owners that current claim approval task is overdue.

Steps to Modify WSO2 BPS Claim Approval Task sample


1)  Setup BPS as mentioned in sample page.

Deploy BPEL package. Creates Roles and Users. But do not deploy humantask package ClaimsApprovalTask.zip since we are going to modify it in next steps.

2) Modify ClaimsApprovalTask.ht

Unzip ClaimsApprovalTask.zip and Add following deadline definition (i.e <htd:deadlines>) inside ApproveClaim task definition (i.e. <htd:task "ApproveClaim"> ) in ClaimsApprovalTask.ht


3) Replace ClaimsApprovalTaskService.wsdl

I did slight changes to wsdl file for this sample. So replace ClaimsApprovalTaskService.wsdl with this file.

4) Deploy Sample

Create new zip file including all files.(modified and unmodified) and deploy it in BPS.
( you can find modified sample from here )

5) Send a Sample Request.

After deployment, send a sample request (like given in sample page). You can see task is created under clerk login. Do not start the human task.

6) Wait 5 mins.

After 5 mins, deadline will be executed. As a result this, a notification is generated and sent to the clerk. Clerk can view notification under Home -> Human Tasks -> Notifications.   




Wednesday, December 14, 2011

BPEL - Extensions


Introduction


WS-BPEL 2.0 supports custom variable assignment mechanisms (Extensible Assign Operations) and user-defined activities (Extension Activities). To use these features, WS-BPEL provides two explicit extension constructs <extensionAssignOperation> and <extensionActivity>.

In order to use BPEL extensions, Extensions must be declared in the BPEL process model. It tells to the BPEL engine which extensions must be available and which are optional. Extension declaration can be done by adding an <extension …> element to the BPEL process model as follows.

<bpel:process...>
            <bpel:extensions>
            <bpel:extension namespace="#extension-namespace#"
                        mustUnderstand="#yes|no#"/>
<bpel:extension namespace="#another-extension-namespace#"
                        mustUnderstand="#yes|no#"/>     
            </bpel:extensions>
 ...
</bpel:process>

Extensible Assign Operations

Extensible Assign Operation allows including extensible data manipulation operations defined as extension elements under namespaces different from the WS-BPEL namespace. If the element contained within the extensionAssignOperation element is not recognized by the BPEL engine and is not subject to a mustUnderstand="yes" requirement from an extension declaration then the extensionAssignOperation operation MUST be ignored.


It is structured as follows.

<bpel:process...>
            <bpel:sequence>
...
<assign validate="yes|no"? standard-attributes>
            standard-elements
            <extensionAssignOperation>
                        assign-element-of-other-namespace
            </extensionAssignOperation>
</assign>
</bpel:sequence>
 ...
</bpel:process>


E4X expressions can be used in Extensible Assign Operations. Following code snippet will show you how to define an ExtensionAssignOperation using E4X expressions..

<bpel:assign name="AssignE4X">
<bpel:extensionAssignOperation>
<js:snippet xmlns:js="http://ode.apache.org/extensions/e4x">
E4X-expressions
</js:snippet>
</bpel:extensionAssignOperation>
</bpel:assign>

The snippet element declares the given extension namespace and it contains the E4X expressions.

Extension Activity

extensionActivity is a mechanism defined in WS-BPEL 2.0, that allows to define new activities, which are not defined by WS-BPEL 2.0 specification.  You can define new activity by placing them inside the <extensionActivity> element.

According to the Specification <extensionActivity> should have a single element, which is qualified with a namespace different from WS-BPEL namespace.  If the element contained within the <extensionActivity> element is not recognized by the WS-BPEL processor and is not subject to a mustUnderstand="yes" requirement from an extension declaration then the unknown activity MUST be treated as if it were an <empty> activity that has the standard-attributes and standard-elements of the unrecognized element; all its other attributes and child elements are ignored.  

(Read full BPEL specification about ExtensionActivity)

ExtenisionActivity structured as follows,

<bpel:process...>
            <bpel:sequence>
...
<extensionActivity>
<anyElementQName standard-attributes>
standard-elements
</anyElementQName>
</extensionActivity>
</bpel:sequence>
 ...
</bpel:process>


Thursday, June 9, 2011

About WS-BPEL

The WS-BPEL stands for Web Services Business Process Execution Language. It is an XML-based language for formally describing business processes and business interaction protocols.

WS-BPEL 2.0 was approved as an OASIS Standard in April 2007. It defines a model and a grammar for describing the behavior of a business process based on interactions between the process and its partners. The interaction with each partner occurs through Web services interfaces. The WS-BPEL process defines how multiple service interactions with these partners are coordinated to achieve a business goal, as well as the state and the logic necessary for this coordination.

Read more: http://bpel.xml.org/about-bpel
You can Find the BPEL specification at http://docs.oasis-open.org/wsbpel/2.0/wsbpel-v2.0.html 


In one of my Next Post, I am going to describe some key concepts in BPEL.

Wednesday, June 8, 2011

Developing WS-BPEL Processes using WSO2 Carbon Studio.

Business Process Execution Language or WS-BPEL lets people orchestrate tasks and activities exposed as Web services. WSO2 Business Process Server can execute process descriptions written in WS-BPEL. Since BPEL is structured and based on XML, it is now far easier for business users to model and execute business processes using open source graphical tools like Eclipse BPEL Designer. This tutorial describes how to Develop a WS-BPEL Processes using WSO2 Carbon Studio.



Read full tutorial at: http://wso2.org/library/tutorials/2011/04/using-carbon-studio-model-wsbpel-process-using-bpel-editor