This recipe will examine the validation of the variables through the assign activity in a BPEL process. At first glance, there may be no obvious relation to the transformation; however, providing the qualitative data for the transformation is crucial, otherwise the results of the transformation might be surprising.
We will extend the example from the Defining the variable recipe with the validation functionality of the BPEL assign activity.. We will modify the example so that it will fail during validation.
In the AssignWSinput
activity, we set the wrong XML fragment as follows:
<assign name = "AssignWSinput" xml:id = "id_15" validate = "yes"> <copy xml:id="id_52"> <from xml:id = "id_53"><literal xml:id = "id_54"><getAvailableCar xml:id = "id_62"> <from xml:id = "id_63">2001-10-26T21:32:52</from> <to xml:id = "id_64">2010-05-05T20:00:00</to> </getAvailableCar></literal></from> <to xml:id = "id_58">$InvokeCarWS_getAvailableCar_InputVariable.parameters</to> </copy> </assign>
The following steps describe the actions required to validate the variable data before performing other operations including the transformation:
If we deploy the example now, it fails, since the validation of the variable content fails. In the Oracle SOA Suite Enterprise Manager Console, we receive the following error:
We can see the detailed report in Flow Trace about the validation error.
To correct the error, we change the assign activity with the following rule:
<copy xml:id = "id_68"> <from xml:id = "id_69">$inputVariable.payload/client:from</from> <to xml:id = "id_70">$InvokeCarWS_getAvailableCar_InputVariable.parameters/ns2:from</to> </copy> <copy xml:id = "id_71"> <from xml:id = "id_72">$inputVariable.payload/client:to</from> <to xml:id = "id_73">$InvokeCarWS_getAvailableCar_InputVariable.parameters/ns2:to</to> </copy>
We deploy the BPEL process and we observe that the BPEL process completes successfully.
Let us check an excerpt of the assign activity as follows:
<assign name = "AssignWSinput" validate = "yes"> </assign>
We see that the activity itself holds the attribute for the validation.
We can achieve the same behavior with the Validate
activity. But, before we do that, let us disable the validation in the activity by setting validate
to no
.
Now, we put the Validate
activity right after the assign activity.
We edit the Validate
activity and add the variables as shown in the following screenshot:
By running the BPEL process, we see that the activity did get executed successfully.
However, if we put the bad variable back, we can observe in Flow Trace in the Oracle SOA Suite Enterprise Management Console that the Validate
activity fails as shown in the following screenshot: