Using the BPEL Designer and Service Engine

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.