Defining local variables in a BPEL process
Too many global variables can cause a lot of confusion and can also consume a lot of memory. Hence, we define global variables only when we need data to be available all the time. For that reason, we omit the scope variable visibility by defining them locally. By doing this, we also achieve higher clarity of the BPEL process source code. This recipe will explain the difference between global and local variables in the BPEL processes.
Getting ready
For this recipe, we will extend the BPEL process from the previous recipe. Note that the variables are tightly related to the scope, which encloses them. We will add a scope to our BPEL process and reuse the same web service. The BPEL process outlook is as shown in the following screenshot:
How to do it…
To define a local variable in a BPEL process, we perform the following steps:
We define a local variable by pressing the (X) icon in the left-side toolbar of the scope. The dialog opens global . However, this...