Listing 1: BPEL Cancel Case Implementation

01 <process>
02    <eventHandlers>
03       <eventHandler name="cancelEvent" . . .>
04          <terminate/>
05       </eventHandler>
06    </eventHandlers>
07    <sequence>
08       . . . <!-- main flow -->
09    </sequence>
10 </process>

Listing 2: BPEL Discriminator Implementation

01 <process>
02    <invoke name="Submit Search Engine 1" . . . />
03    <invoke name="Submit Search Engine 2" . . . />
04    <receive name="Search Complete" . . ./>
05    <!-- got one, proceed -->

Listing 3: BPEL Discriminator Subprocess

01 <process>
02    <receive name="Get Search Request" . . . />
03    <!-- perform the search -->
04    <invoke name="Search Complete" . . ./>
05 </process>

Listing 4: BPEL N-of-M Join Implementation

01 <process>
02    <invoke name="Check credit" . . . />
03    <invoke name="Check criminal record" . . . />
04    <invoke name="Check natural citizen" . . . />
05    <receive name="Clearance Event" . . ./>
06    <receive name="Clearance Event" . . ./>
07    <!-- got two of three, proceed with the clearance -->

Listing 5: BPEL Interleaved Parallel Routing Implementation

01 <process>
02    <variables>
03       <variable name="C" . . . />
04    </variable>
05    <flow>
06       <scope name="optical" variableAccessSerializable="yes">
07          <sequence>
08             write to variable C
09             run optical activity
10             write to variable C
11          </sequence>
12       </scope>
13       <scope name="dental" variableAccessSerializable="yes">
14          <sequence>
15             write to variable C
16             run dental activity
17             write to variable C
18          </sequence>
19       </scope>
20       <scope name="medical" variableAccessSerializable="yes">
21          <sequence>
22             write to variable C
23             run medical activity
24             write to variable C
25          </sequence>
26       </scope>
27    </flow>
28 </process>