Developer Guide to the BPEL Designer

The Palette Elements

This section is the palette elements reference.

The Process Element

Using the Invoke Element

Using the Receive Element

Using the Reply Element

Using the Partner Link Element

Using the Assign Element

Using the Empty Element

Using the Wait Element

Using the Throw Element

Using the Rethrow Element

Using the Exit Element

Using the Compensate Element

Using the CompensateScope Element

Using the If Element

Using the While Element

Using the Repeat Until Element

Using the For Each Element

Using the Pick Element

Using the Flow Element

Using the Sequence Element

Using the Scope Element

The Process Element

The Process element is already present in your diagram. The New Project wizards always create a skeletal BPEL file that contains at least a process element. Therefore, the Process element is not part of the Palette. The Process element is assumed to be present, as it is the minimum requirement for a BPEL file.

The following screenshot shows the representation of a process in the Understanding the Travel Reservation Service sample.

The Process element.

Usage

  1. Right-click the Process element and choose Add from the pop-up menu to add the following:

  2. Specify the name and the target namespace of the Process element in the Properties window, invoked by right-clicking the element and choosing Properties.

Processes

A BPEL process can be synchronous or asynchronous. A synchronous BPEL process blocks the client (the one which is using the process) until the process finishes and returns a result to the client. An asynchronous process does not block the client. Rather it uses a callback to return the result (if any). Usually we use asynchronous processes for longer-lasting processes and synchronous for processes that return a result in a relatively short time. If a BPEL process uses asynchronous web services, the process itself is usually also asynchronous.

Using the Invoke Element

The Invoke element enables the business process to invoke a one-way or request-response operation on a portType offered by a partner. It enables the business process to send messages to partners. The operation is defined in the partner's WSDL file.

Usage

  1. In the Design view, drag the Invoke element from the Palette to the diagram.

  2. Perform one of the following procedures to associate the Invoke element with a Partner Link element:

    • Directly draw a message flow from the Invoke element to the target Partner Link.

    • Double-click the Invoke element. A dialog opens where you can examine or change the following:

      • The name of the Invoke element.

      • The partner link that is invoked.

      • The operation associated with the Invoke element.

      • The input variable associated with the Invoke element.

      • The output variable.

        Both input and output variables can be created or browsed through this dialog.

      Main tab of the property editor for the Invoke element

In the Property Editor dialog box, you can either create a variable or use an existing variable to hold input and output data. Click the Create button to create a variable for the Invoke element, and click Browse to choose an existing variable.

Note that when you click the Browse button, the Input Variable Chooser or the Output Variable Chooser dialog boxes opens. In these dialog boxes, a checkbox with the option to show variables with appropriate types appears. This checkbox restricts the list of available variables to those which are of the proper type for the activity you are configuring. In this way the Design view helps you develop valid BPEL code.

Correlations

Correlation sets on invoke activities, which deal with outbound operations, are used to validate that outgoing messages contain data which is consistent with the data contained within specified correlation set instances.

The Correlations tab in the Invoke Property Editor dialog box enables you to examine or specify a correlation set.

Correlations Tab

The tab shows:

For more information see Understanding Correlation. Using the Correlation Wizard.

Using the Receive Element

The Receive element allows the business process to do a blocking wait for a particular message to arrive.

Usage

  1. In the Design view, drag the Receive element from the Palette to the diagram.

  2. Double-click the Receive element (or right-click it and choose Edit) to configure its properties. Here the example is provided for the Travel Reservation Service sample:

    • The name of the Receive element (ReceiveItinerary ).

    • The partner link (Travel).

    • The operation associated with the Receive element (buildItinerary).

    • The input variable to the Receive element (ItineraryIn ).

      Select Browse for the Input Variable to open the Input Variable chooser, where you can choose other variables associated with this process. Select Create to create a new variable.

    • Create Instance. If selected, an instance of the BPEL process starts when an associated message arrives. Note that if the Receive activity is the first activity in your business process, the Create Instance checkbox must be selected.

      Main tab of the property editor for the Receive element
  3. You can also edit some of the element's properties in the Properties window. To open the window, right-click the Receive element and choose Properties or choose Window > Properties (Ctrl-Shift-7) from the main menu. You can edit the information by clicking on the ellipsis button. You cant edit the shadowed information from this window, to change it open the property editor as described above.

    Receive Properties window

Correlations

The Correlations tab in the Receive Property Editor dialog box enables you to examine or specify a correlation set.

Correlations Tab

The tab shows:

For more information see Understanding Correlation. Using the Correlation Wizard.

Using the Reply Element

Use this activity to return a message from the process to the same partner that initiated the operation. The combination of Receive and Reply activities creates a request-response operation.

This activity is used in a synchronous (request/response) operation, and specifies the same partner, port type and operation as the Receive activity that invoked the process.

Usage

  1. In the Design view, drag the Reply element from the Palette to the diagram.

  2. Double-click the Reply element (or right-click and choose Edit) to open a Property Editor dialog box for the Reply element. In this dialog box, you can specify the following:

    • The name of the element.

    • The Partner Link.

    • The operation.

    • Type of response: Normal Response or Fault Response.

      • Select Normal Response if the Reply element is to be used for the normal response message type. Optionally, specify the output variable: either create a new output variable or browse for an existing variable.

      • Select Fault Response if the Reply element is to be used to send a fault message. Choose a fault name and, optionally, specify the fault variable: either create a new fault variable or browse for an existing variable.

      Reply Property Editor
  3. You can also edit some of the element's properties in the Properties window. To open the window, right-click the Receive element and choose Properties or choose Window > Properties (Ctrl-Shift-7) from the main menu. You can edit the information by clicking on the ellipsis button. You cant edit the shadowed information from this window, to change it open the property editor as described above.

    Reply Properties Window

Correlations

The Correlations tab in the Reply Property Editor dialog box enables you to examine or specify a correlation set.

Correlations Tab

The tab shows:

For more information see Understanding Correlation. Using the Correlation Wizard.

Using the Partner Link Element

Partner Link elements identify the parties that interact with your business process. Each link is defined by a partner link type and a role name.

Partner Link Types and Roles

The type determines the relationship between a process and its partners by defining the roles played by each service in a conversation. The relationship is further determined by specifying the port type provided by each service to receive messages. Each role specifies one port type in the WSDL file.

Roles determine the conversational aspect of this process or its partner. You use a single role for a synchronous operation as the results are returned using the same operation. You use two roles in an asynchronous operation as the partner role switches during a callback.

It is easy to confuse partner links and partner link types, however:

Partner link types are prerequisites to the Partner Link element definition. A Partner Link element can only be defined by referring to a particular partner link type and role which, as mentioned, must be defined in a WSDL file.

Usage

To add the Partner Link element to the BPEL process, do one of the following:

Note: When you drag the web service node, the BPEL Designer retrieves the WSDL file from the Application Server. To successfully retrieve the WSDL file, the Application Server has to be running and the web service project must be deployed.

When you drag the Partner Link element, a WSDL file node, or a web service node to the diagram, the Partner Link Property Editor appears.

The Partner Link Property Editor

The Partner Link Property Editor dialog box enables you to establish partner links for your BPEL processes.

The Partner Link Property Editor is invoked by double-clicking a Partner Link element on the diagram, or right-clicking the Partner Link element and choosing Edit. The Partner Link Property Editor also appears when you drag the Partner Link element, a WSDL file node, or a web service node to the diagram.

With the Partner Link Property Editor, you can specify:

Further on you can choose whether to use the existing partner link type or create a new partner link type.

If the WSDL file you selected contains partner link types, the Use Existing Partner Link Type option is selected and the Partner Link Type drop-down list is populated with the partner link types found in the WSDL file. You can use one of the existing partner link types or select the Use a Newly Created Partner Link Type option to create a new partner link type.

If the WSDL file does not contain partner link types, the Use a Newly Created Partner Link Type option is selected.

PartnerLink property editor

You can also review and modify the Partner Link's properties in the Properties window invoked by right-clicking the element and choosing Properties.

Partner Link Layout

The partnerlinks are put to the left and to the right margin of the process diagram. Service requestors are placed on the left side, service providers are placed on the right side. To define the role and to choose the appropriate side for each partnerlink the IDE uses the order of roles defined for the partnerLinkType in the WSDL file. The role defined first in the partnerLinkType in the WSDL file is considered to be a service role, the second defined role is considered to be the role for the requestor and callback receiver. If the roles are defined in the reverse order in the wsdl file (the callback receiver role is defined on the first place, and the service role on the second place) then you get the improper partnerlink layout in the BPEL process diagram, though the operation is not damaged. If a partnerlink appears on the wrong side you probably have to go to the WSDL file and swap places for the role definitions in the partnerLinkType.

Dynamic Addressing

Sometimes you need to communicate with partner services whose endpoints are not known beforehand or you need to change an endpoint reference (EPR) during the process execution. The Dynamic Partner Links feature allows you to dynamically assign an endpoint reference to the partner link. This means you can use one partner link for communication with several web–services as long as these services have the same interface.

Each partner link has abstract information and concrete information defined. While the abstract information describing web-service interface should be static, the concrete access information such as address and port can be discovered and used dynamically.


Note –

For successful deployment of the process a partner link should be completely defined. It means that when you deploy the project, the WSDL file for the partner link should contain both the abstract and the concrete information for the partner link defined, including address and port, though later the concrete information can be changed independently from the WSDL file.



Note –

The BPEL specification mandates that only the partner EPR can be changed dynamically. In BPEL terms, only the partnerRole of a partnerLink element can have a new value assigned. The myRole value doesn't change after the BPEL has been deployed.


To assign a new EPR to a partner link you can use the standard Assign activity and the BPEL Mapper.

The EPR information can be provided in different ways:

If you use an incoming message, an EPR schema should be defined as a part of the message in WSDL. To assign the EPR to a partner link, use the message variable.

ProcedureTo assign a new endpoint reference to a partner link from a variable:

  1. Create a new Assign activity in the process.

  2. Open the BPEL Mapper

  3. In the target tree on the right, find the partner link to which you want deliver a new concrete part.

  4. In the source tree, find a variable containing the new endpoint address

    The address of the web-service can be defined in terms of different schemas, and the JBI container requires a special data type called ServiceRefType which is a simple wrapper for any endpoint-describing data type.

    To wrap your data:

    • In the mapper toolbar, choose BPEL > Wrap with Service Reference.

      This function is a doXslTranform function that uses a predefined XSL-style sheet.

      Wrap with Service Reference function
    • This function is a doXslTranform function that uses a predefined XSL-style sheet. A new concrete part is assigned to the partner link.

      New Endpoint Reference is Assigned to the Partner Link

    Note –

    The runtime supports only schemas included into WS-BPEL 2.0 specification. The WS-Addressing schema is not included in the BPEL specification and as a result it is not supported by the BPEL runtime. When the WS-Addressing schema is used for the first time it is copied from NetBeans global catalog to the BPEL Module project source root and further the project refers to the local copy of the schema. The adressing.xsd schema also appears among the Module's procees files in the Projects window.


Using the Assign Element

The Assign activity assigns values to variables. You use the Assign element to copy data from one variable to another, construct and calculate the values of expressions, and store new data in variables. Expressions are required to perform simple computation or operate message selections, properties, and literal constants to produce a new value for variables. The Assign activity can contain one or more elementary assignments.

Usage

Use the BPEL Mapper to define the copy rules for the Assign activity or add expressions. For more information, refer to the Assign Activity Scenario section of the guide.

The BPEL Mapper windows opens when you select the Assign activity on the diagram. If this window is not visible, you can invoke it manually, by choosing Window > Other > BPEL Mapper from the main menu.

Assign Element Properties

The Properties window of the Assign element, invoked by right-clicking the element and choosing Properties, contains two properties:

Using the Empty Element

The Empty element has no operation associated with it. It is usually used as a placeholder within a process, to catch and suppress faults, or to help synchronize actions within a flow activity that are executed concurrently.

The Empty element can be used when someone else will be implementing a business process, or when the activities within a flow activity need to be synchronized.

Usage

Drag the Empty element from the Palette to the diagram.

Using the Wait Element

Use a Wait element to specify a wait condition based on a unit of time or a duration.

Usage

Drag the Wait element from the Palette to the diagram. Like other elements, it must be placed in the correct position in the process flow; otherwise you will not see the element in the diagram.

Right-click the element in the diagram and choose Properties to invoke a Properties window. Using the Properties window, you can specify:

Using the Throw Element

Use this activity to signal an internal fault.

Usage

In defining the properties of this element, you can specify a fault name and a fault variable. These details can then be passed onto a fault handler that is configured to deal with this kind of exception.

Throw Element Properties

The properties of the Throw element can be configured via the Properties window invoked by right-clicking the element and choosing Properties. The options are:

Using the Rethrow Element

The Rethrow activity can only be used within a fault handler. The Rethrow activity is used to rethrow the fault caught by the fault handler. Before adding the Rethrow element to the BPEL process, you should add a Fault Handler element to the Process or Scope element and add a Catch or Catch All element to the Fault Handler container.

Usage

There are no properties to be defined for the Rethrow element as it rethrows the fault caught by the fault handler.

Using the Exit Element

Use this activity to halt the execution of an activity or a process: either within the process, within a structured activity, or within a handler.

Usage

In the Design view, drag the Exit element from the Palette to the diagram.

Note: The BPEL runtime does not support Exit within the Flow and On Alarm elements, or within the On Event child of the Event Handler element.

Using the Compensate Element

The Compensate activity can only be used within Catch, CatchAll, Compensation Handler or Termination Handler elements.

The Compensate activity causes compensation of all scopes immediately enclosed into the scope containing the fault handler, compensation handler or termination handler with the Compensate activity.

Usage

From the Palette, drag the Compensate activity and place it inside the Catch, CatchAll, Compensation Handler or Termination Handler element on the diagram. The Compensate activity requires no property configuration, its behavior is pre-defined.

Using the CompensateScope Element

The Compensate activity can only be used within Catch, CatchAll, Compensation Handler or Termination Handler elements.

The Compensate Scope activity enables compensation for one specified Scope or Invoke element enclosed into the scope that contains the handler with the Compensate Scope activity by invoking the compensation handler of the Scope or Invoke element.

Usage

Using the If Element

The If activity supports conditional behavior of a business process instance. The If activity consists of conditional branches defined by the If and Else If elements, followed by an optional Else branch. The conditions on If and Else If branches are evaluated in the order they appear. During execution, the first branch whose condition holds true is taken and provides the activity specified for the If activity. In other words, if there are several Else If branches whose conditions hold true, only the first of them will be executed.

If none of the branches evaluates to true, then the Else path is chosen. If the Else branch is not explicitly specified, this branch is considered to contain an Empty activity. The If activity is complete when the activity of the selected branch completes.

Usage

  1. In the Design view, drag the If element from the Palette to the diagram.

  2. Double-click the If element on the diagram or select the Mapper tab on the toolbar, the BPEL Mapper opens.

  3. Specify the condition for the If element using the BPEL Mapper. For more information, refer to the If Activity Scenario section of the guide. You can also specify the condition manually in the Properties window, invoked by right-clicking the element and choosing Properties.

  4. (Optional) In the Properties window, enter the name for the If element.

    If Properties Window
  5. Add the element that will be executed if the condition is true into the If element. Configure the nested element. If you add another element into the If element, the nested elements are automatically wrapped in the Sequence element.

  6. Add other branches (Else If and Else) as described below.

Adding an Else If Branch to the If Element

  1. Right-click the If element and choose Add Else If.

  2. Add an activity to the Else If that will be executed if the condition defined for this Else If element is true. To define a condition, use the BPEL Mapper.

  3. (Optional) Add more Else If activities by choosing Add Else If and add activities to them.

Adding an Else Branch to the If Element

Drag the activity you want to be executed on the Else branch onto the connector path marked with a slash mark. Configure the nested activity.

Reordering Else If Branches

In the Design view, drag the Else If branch that you want reordered and drop it onto the placeholder that appears next to another Else If branch.

Using the While Element

Use the While element to repeatedly execute one or more activities as long as specific conditions are in place at the beginning of each iteration. This element contains other elements that are repeated while success criteria you specify are met. If the condition you specify leads to false, none of the activities listed will be executed.

Note: the While element first checks the validity of the condition and then executes the iterative activity. Conversely, the Using the Repeat Until Element element first executes the activity and then checks the validity of the condition.

Usage

  1. In the Design view, drag the While element from the Palette to the diagram.

  2. Drag an activity that will be repeatedly executed and place it inside the While element. If needed, configure the activity's properties.

  3. Use the Properties window to specify the name and condition of the While element. You can enter the condition manually or use the The BPEL Mapper to generate the condition for you. To open the BPEL Mapper window, choose Window > BPEL Mapper or right-click the While element on the diagram and choose Show BPEL Mapper.

Using the Repeat Until Element

Use the Repeat Until element to repeatedly execute one or more activities as long as specific conditions are in place after the execution of each iteration. This element contains other elements that are repeated until the success criteria you specify are met. If the condition you specify leads to true, the activities listed will be executed once.

Note: the Repeat Until element first executes the iterative activity and then checks the validity of the condition. Conversely, the While element first checks the validity of the condition and then executes the activity.

Usage

  1. In the Design view, drag the Repeat Until element from the Palette to the diagram.

  2. Drag activities that will be repeatedly executed and place them inside the Repeat Until element. If needed, configure the activity's properties.

  3. Use the Properties window to specify the name and condition of the Repeat Until element. You can enter the condition manually or use the The BPEL Mapper to generate the condition for you. To open the BPEL Mapper window, choose Window > Other > BPEL Mapper or right-click the Repeat Until element on the diagram and choose Show BPEL Mapper.

Using the For Each Element

Use the For Each element to repeatedly execute its contained scope activity exactly N+1 times where N equals the Final Counter Value minus the Start Counter Value.

Usage

  1. In the Design view, drag the For Each element from the Palette to the diagram.

  2. Add elements that will be repeatedly executed from the Palette into the For Each element. The elements that you add are automatically wrapped into the Scope element.

  3. Right-click the For Each element and choose Properties to open its Properties window.

The Properties window for the For Each element includes the properties listed below.

Using the Pick Element

The Pick element blocks the process and waits until one of the specified events occurs. After the specific event occurs, the activity associated with this event is performed. The possible events are the arrival of a message or a timer-based alarm. The occurrence of the events is mutually exclusive. If more than one of the events occurs, then the selection of the activity to perform depends on which event occurred first.

The Pick activity provides two branches, On Message and On Alarm. The branch whose condition is satisfied first (i.e. a message is received or the specified timer expires) is executed. When you add a Pick element to your diagram, it automatically includes one On Message statement in which you specify the properties of the message that the process awaits from a partner service. Each Pick element must include at least one On Message statement. The On Alarm branch contains a timer you can use to specify how long the process is to wait.

Usage

  1. In the Design view, drag the Pick element from the Palette to the diagram.

  2. For the On Message branch, configure the properties of the message for which the process is waiting. The configuration is similar to that of the Usage element.

  3. From the Palette, drag the activity that will be executed and place it inside the On Message branch. Configure the activity's properties.

  4. (Optional) Add more On Message branches by choosing Add > On Message from the pop-up menu and configure them as described above.

  5. (Optional) Add one or more On Alarm branches following the procedure below.

Adding an On Alarm branch

  1. Right-click the Pick element and choose Add > On Alarm from the pop-up menu.

  2. Configure the timer via the Properties window, invoked by right-clicking the element and choosing Properties. The available options are:

    • Alarm Type — used to choose the type of alarm. The type can be one of the following:

      • For — specifies a duration for the process to wait.

      • Until — specifies a deadline for the process.

    • For/Until — used to configure the deadline or the duration for the chosen alarm type. Click the ellipsis button (...) to specify the time. You can also use the The BPEL Mapper.

  3. Find the activity you want executed after the time expires, and drag it from the Palette to the placeholder inside the On Alarm element.

  4. (Optional) Add one or more On Alarm branches as described above.

Pick Element Properties

The Properties window for the Pick element, invoked by right-clicking the element and choosing Properties, includes the following fields:

Pick Properties Window

Using the Flow Element

Use the Flow element to define a set of activities that will execute concurrently (in parallel).

The Flow activity is a structured activity, containing other activities separated into individual control paths or branches. You can embed as many paths in the activity as you want, and they will all be executed simultaneously.

During execution, each path is executed concurrently, and the activities on each are executed in the order in which they appear, unless they are the source of a link. When the activities are the source of a link, the condition of the link and the join condition of the activity must be evaluated. If the link conditions that lead to an activity conflict with those of its join condition, then a fault is thrown on that activity.

Usage

In the Design view, drag the Flow Element from the Palette to the diagram.

Drag an element to the placeholder inside the Flow element. If you add another element into the same branch of the Flow element, the elements within a branch are automatically wrapped in the Sequence element.

Adding Branches to the Flow Element

You can add one or more branches to the Flow element. The Flow element has a special user interaction style. It always shows a placeholder for the next branch that you might wish to add. To add a new branch, drag an element from the Palette to the immediately available "next branch" placeholder.

Changing the Order of Elements inside Flow

To change the order of activities inside the Flow element:

  1. In the Design view, right-click the Flow element and select Change Order.

  2. Select an element and use the Move up or Move down buttons to change the position of the element inside the container.

Using the Sequence Element

Use the Sequence element to nest a series of activities into your process. The activities within a sequence will execute in strict sequential order. Process execution returns to the business process when the last activity within the nest has completed.

Usage

Drag the Sequence element from the Palette to the diagram.

Adding Child Activities to the Sequence

You can add one or more child activities to the Sequence. The Sequence element has a special user interaction style. It always shows one or more valid placeholders for the next activity that you might wish to add. To add a new child activity, drag and drop an element from the Palette onto the immediately available next or previous activity placeholder.

Changing the Order of Elements inside Sequence

To change the order of activities inside the Sequence element:

  1. In the Design view, right-click the Sequence element and select Change Order.

  2. Select an element and use the Move up or Move down buttons to change the position of the element inside the container.

Using the Scope Element

The Scope activity is essentially a collection of child activities that can have their own Variables, Fault and Event Handlers, and correlation sets. The Scope activity provides the behavior context for the child elements. The attributes defined for a parent Scope have local visibility inside this Scope. For example, the variables declared for a Scope are visible only inside that Scope and all nested Scopes. These variables can then be used for the child activities of this Scope.

Usage

  1. In the Design view, drag the Scope element from the Palette to the diagram.

  2. Right-click the element and choose Add from the pop-up menu to add the following:

  3. In the Design view, drag elements from the Palette and place them inside the Scope element.

  4. Configure the elements.

  5. (Optional) Specify the name of the Scope element in the Properties window, invoked by right-clicking the element and choosing Properties.

Variables

Variables in BPEL programming function just as they do in other programming languages: they hold temporary values, form parts of expressions, or are passed as parameters to external partners. Normally, you need a variable for every message sent to or received from a partner service. The BPEL Designer supports the following types of variables:

Global and Local Variables

The variables defined at the Process root are global variables, which have a global visibility throughout the entire process. The variables defined within a particular Scope are visible only inside that Scope and all nested Scopes. These variables are called local variables. A variable defined for an inner Scope element can hide an upper defined variable of the same name.

The name of a variable must be unique among the names of all variables defined within the same Scope.

ProcedureTo define a variable:

  1. Right-click the Process or Scope element and select Add > Variable.

  2. In the Create New Variable dialog box, name the variable. The name should be unique within this Scope element.

  3. Expand the node corresponding to the type of the new variable and select its type. You have the following options:

    • Built-in Types. Expand the Built-in Types node, select the type's name, and click OK.

    • Message Type. Expand a .wsdl file node, select a message type and click OK.

    • XML Schema. Expand an .xsd file node or a .wsdl file that contains an embedded schema. Expand the Global Complex Type, Global Simple Type, or Global Elements Simple nodes, select the appropriate type, and click OK.

      For your convenience, global types of variables are displayed in bold.

  4. (Optional) Clear the Show Imported Files Only checkbox to view the contents of non-imported WSDL and XML schema files.

  5. Click OK.

    By default, the Create New Variable dialog box only shows those files that have already been referenced in the process. However, the project may contain other WSDL and XSD files which have not yet been imported into the process. If you select a type for the new variable that is defined in a non-imported file, the IDE will automatically add the required import to the BPEL process.

    You can also add variables from the The Navigator Window window. To add a variable, select BPEL Logical View in the Navigator, expand your BPEL Module project's node, right-click the Variables node and choose Add Variable.

ProcedureTo edit a variable:

  1. In the Navigator window, select BPEL Logical View.

  2. Expand BPEL Module project's node > Variables and double-click the variable you want to edit.

  3. In the Property Editor dialog box for the variable, change the variable type and name.

  4. Click OK.