The business state machine in this sample works in conjunction
with a business process in order to achieve its goal.
This business process (which is invoked by the state machine) is
responsible for: 1)
- checking if the third party is busy (to simplify the sample, the third
party is never busy, and so the call should always connect),
- connecting the call to the third party and
- disconnecting the call from the third party.
- Create a new business process as follows:
- Right-click the BSM_Telco module and
chose from the list.
- In the New Business Process wizard, name
the business process TelcoConnectionService and click Next.
- On the Select an Interface page, click
the Select an existing Interface radio button, and
browse to the TelcoConnectionInterface.
- From the Operation list, select isBusy,
and click Finish.
A new business process is created, and appears in the editor as
shown in this image:

- Delete the automatically generated Receive and Reply activities.
- From the second sub-palette, choose a Receive choice activity,
and drop it onto the canvas. The activity will appear in the diagram
with a single control path already defined.

- Configure the first control path:
- Rename the Receive element to isBusy.
- In the Details tab for the isBusy element,
browse to the TelcoConnectionInterface for the partner,
choose isBusy for the Operation, and select To as
the input variable.
- Drop a snippet activity to the control path. In the Details tab,
click the Java radio button, and paste the following
text into the Java editor.
java.lang.String __result__1 = "BPEL: " + To + " is not busy";
{// print to log
System.out.println(__result__1);
}
boolean __result__3 = false;
IsBusy = new java.lang.Boolean(__result__3);
- Drop a reply activity to the control path. In the Details tab,
browse to the TelcoConnectionInterface , choose isBusy for
the Operation, and select IsBusy as the output variable.

- Create a second control path:
- Click and hover over the ReceiveChoice activity to launch the
action menu.
- Chose the Add Receive icon. Another
control path appears in the parent receive choice activity.
- Rename the Receive element to connect.
- In the Details tab for the connect element,
browse to the TelcoConnectionInterface for the partner,
choose connect for the Operation, and select From as
the first input variable, and To as the second.
- Drop a snippet activity to the control path with the following
text:
java.lang.String __result__1 = "BPEL: Connect call from ";
java.lang.String __result__3;
{// append text
__result__3 = __result__1.concat(From);
}
java.lang.String __result__4 = " to ";
java.lang.String __result__5;
{// append text
__result__5 = __result__3.concat(__result__4);
}
java.lang.String __result__7;
{// append text
__result__7 = __result__5.concat(To);
}
{// print to log
System.out.println(__result__7);
}
boolean __result__9 = true;
Ok = new java.lang.Boolean(__result__9);
- Drop a reply activity to the control path. In the Details tab,
browse to the TelcoConnectionInterface , choose connect for
the Operation, and select Ok as the output variable.
- Create a third control path:
- Add another Add Receive element and name
it disconnect
- In the Details tab for the disconnect element,
browse to the TelcoConnectionInterface for the partner,
choose disconnect for the Operation, and select From as
the first input variable, and To as the second.
- Drop a snippet activity to the control path with the following
text:
java.lang.String __result__1 = "BPEL: Disconnect call from ";
java.lang.String __result__3;
{// append text
__result__3 = __result__1.concat(From);
}
java.lang.String __result__4 = " to: ";
java.lang.String __result__5;
{// append text
__result__5 = __result__3.concat(__result__4);
}
java.lang.String __result__7;
{// append text
__result__7 = __result__5.concat(To);
}
{// print to log
System.out.println(__result__7);
}
boolean __result__9 = true;
Ok = new java.lang.Boolean(__result__9);
- Drop a reply activity to the control path. In the Details tab,
browse to the TelcoConnectionInterface , choose disconnect for
the Operation, and select Ok as the output variable.
When you are finished, the final process should look like the one
in this image:
