What Happens When You Create an If Activity

Using Conditional Branching in a BPEL Process 10-9

2. Drag a While activity into the designer.

3. Click the + sign to expand the while activity. The while activity has icons to allow you to build condition expressions and to validate the while definition. It also provides an area for you to drag an activity to define the while loop.

4. Drag and define additional activities for using the while condition into the Drop

Activity Here area of the While activity for example, a Scope activity. The activities can be existing or new activities. 5. Press Ctrl+Space to invoke the XPath Building Assistant or click the XPath Expression Builder icon to open the Expression Builder dialog. 6. Enter an expression to perform repeatedly, as shown in Figure 10–10 . This action is performed until the given boolean while condition is no longer true. In this example, this activity is set to loop while less than 5. Figure 10–10 While Activity with an Expression

7. Click OK when complete.

10.3.2 What Happens When You Create a While Activity

Example 10–4 provides an example of the .bpel file after design completion. The while activity includes a scope activity. The scope activity includes invoke, assign, and wait activities. Database exception handling tasks are performed by creating a local variable and placing the invoke activity inside the scope activity. The local variable is set to false represented by 0. You attempt to call the external partner service in the while loop activity until the local variable is satisfied set to 1. The while activity is set to loop a maximum of five times. In the case of an exception, you reset the flag to false 0. Example 10–4 While Activity while name=While_1 condition=bpws:getVariableDatadbStatus 5 scope name=Scope_1 faultHandlers catchAll 10-10 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite sequence name=Sequence_2 assign name=assign_DB_retry copy from expression=bpws:getVariableDatadbStatus + 1 to variable=dbStatus copy assign wait name=Wait_30_sec for=PT31S sequence catchAll faultHandlers sequence name=Sequence_1 invoke name=Write_DBWrite partnerLink=WriteDBRecord portType=ns2:WriteDBRecord_ptt operation=insert inputVariable=Invoke_DBWrite_merge_InputVariable assign name=Assign_dbComplete copy from expression=10 to variable=dbStatus copy assign sequence scope while

10.4 Creating a repeatUntil Activity to Define Conditional Branching

If the body of an activity must be performed at least once, use a repeatUntil activity instead of a while activity. The XPath expression condition in the repeatUntil activity is evaluated after the body of the activity completes. The condition is evaluated repeatedly and the body of the activity processed until the provided boolean condition is true.

10.4.1 How to Create a repeatUntil Activity

To create a repeatUntil activity: 1. In the Component Palette, expand BPEL Constructs. 2. Drag a Repeat Until activity into the designer. 3. Double-click the Repeat Until activity. 4. Enter a name or accept the default value.

5. In the Condition field, click the XPath Expression Builder icon to enter an XPath

expression condition. The Expression Builder dialog is displayed.

6. Enter a boolean XPath expression condition, and click OK.

The condition you entered is displayed in the Repeat Until dialog, as shown in Figure 10–11 . Note: This activity is supported in BPEL version 2.0 projects.