Java Integration
Transform Anything with Java
Using Flow Operation in SOA
Flow is a very useful activity in BPEL where it is used for psuedo parallelism. A simple scenario can explain flow better. An insurance quote site would need to interact with multiple Insurance companies to provide a quotation to the user. The flow activity can be used to call multipe insurance partners and finally consolidate the output and provide to the customer.
To acheive full parallelism, use nonBlockingInvoke property in the parnerlink.
<partnerLinkBinding name="XXXXXX"><property name="wsdlLocation">YYYYYY.wsdl</property><property name="nonBlockingInvoke">true</property></partnerLinkBinding>
I would rather provide a simple example for flow. The example takes to integer and provides added and subtracted result. We will use flow activity here.
1. Open JDeveloper.
2. Create a New SOA Project with Empty BPEL Composite.
3. Add a Flow activity and create 2 flows(one for addition and the other for subtraction. The BPEL process should look like below.

4. Below is the BPEL Code.
<?xml version = "1.0" encoding = "UTF-8" ?>
<!--
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Oracle JDeveloper BPEL Designer
Created: Mon Sep 15 11:48:56 PDT 2014
Author: bmuthusamy
Type: BPEL 1.1 Process
Purpose: Synchronous BPEL Process
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<process name="flow_test"
targetNamespace="http://xmlns.oracle.com/POC/FlowExample/flow_test"
xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:client="http://xmlns.oracle.com/POC/FlowExample/flow_test"
xmlns:ora="http://schemas.oracle.com/xpath/extension"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bpel2="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
<!--
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
PARTNERLINKS
List of services participating in this BPEL process
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<partnerLinks>
<!--
The 'client' role represents the requester of this service. It is
used for callback. The location and correlation information associated
with the client role are automatically set using WS-Addressing.
-->
<partnerLink name="flow_test_client" partnerLinkType="client:flow_test" myRole="flow_testProvider"/>
</partnerLinks>
<!--
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
VARIABLES
List of messages and XML documents used within this BPEL process
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<variables>
<!-- Reference to the message passed as input during initiation -->
<variable name="inputVariable" messageType="client:flow_testRequestMessage"/>
<!-- Reference to the message that will be returned to the requester-->
<variable name="outputVariable" messageType="client:flow_testResponseMessage"/>
<variable name="varAdd" type="xsd:integer"/>
<variable name="varSubtract" type="xsd:integer"/>
</variables>
<!--
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ORCHESTRATION LOGIC
Set of activities coordinating the flow of messages across the
services integrated within this business process
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<sequence name="main">
<!-- Receive input from requestor. (Note: This maps to operation defined in flow_test.wsdl) -->
<receive name="receiveInput" partnerLink="flow_test_client" portType="client:flow_test" operation="process" variable="inputVariable" createInstance="yes"/>
<!-- Generate reply to synchronous request -->
<flow name="Flow1">
<sequence name="Sequence">
<assign name="AssingAddition">
<copy>
<from expression="bpws:getVariableData('inputVariable','payload','/client:process/client:X') + bpws:getVariableData('inputVariable','payload','/client:process/client:V')"/>
<to variable="varAdd"/>
</copy>
</assign>
</sequence>
<sequence name="Sequence1">
<assign name="AssignSubtraction">
<copy>
<from expression="bpws:getVariableData('inputVariable','payload','/client:process/client:X') - bpws:getVariableData('inputVariable','payload','/client:process/client:V')"/>
<to variable="varSubtract"/>
</copy>
</assign>
</sequence>
</flow>
<assign name="AssignOutput">
<copy>
<from expression="concat('Addition Result ', bpws:getVariableData('varAdd'),' ', 'Subtraction Result ', bpws:getVariableData('varSubtract'))"/>
<to variable="outputVariable" part="payload"
query="/client:processResponse/client:result"/>
</copy>
</assign>
<reply name="replyOutput" partnerLink="flow_test_client" portType="client:flow_test" operation="process" variable="outputVariable"/>
</sequence>
</process>
5. Deploy and test the BPEL code. The output and BPEL flow are shown below.

