Java Reference
In-Depth Information
Validating Inbound Message Data
Problem
You want to validate the data in an inbound message against its XML schema definition.
Solution
Use the
<validate>
activity, and specify the name of the variables to validate. If validation
fails, the standard BPEL fault
invalidVariables
is thrown.
Discussion
The
<validate>
activity validates a list of variables against the schema that defines them.
Here is an example:
<sequence>
<receive name="sendPurchaseOrder"
partnerLink="POServicePLink"
portType="pos:purchaseOrderPT"
operation="sendPurchaseOrder"
variable="purchaseOrderRequest"
createInstance="yes">
</receive>
<validate name="validatePO" variables="purchaseOrderRequest" />
<assign name="Assign_2">
This activity is fairly straightforward, defining only the two attributes just shown, and one
other:
suppressJoinFailure
. If more than one variable is intended to be validated, separate
them with spaces in the
variables
attribute. If the engine discovers a violation of the schema
in the variables listed, it will throw an
invalidVariables
fault. You can catch this fault and
deal with it as you would any other. Not all engines support this feature. For example, Sun's
BPEL SE that runs in the OpenESB JBI container does not implement this activity.
NOTE
Validation baked into your process in this manner can be a hindrance to performance.