To demonstrate how we can use the XSLT transformation in our BookWarehousingBPEL
process, let's add it to the process:
<assign>
activity for preparing the AnotherBookstoreRequest
variable, we will first remove the <assign>
activity from the third flow branch. It is located just before the <invoke>
activity for the AnotherBookstoreBPEL
process.AnotherBookstoreBPEL
partner link.inputVariable
. The Target Variable will be AnotherBookstoreRequest
. In both cases, we will address the payload part of the message:We have created an XSLT transformation and used it in the <assign>
activity to transform and map two different variables, each containing data based on its own schema. If we switch to source code, we can see that the following XSLT has been created:
Also, in the BPEL source code, we can see that the <assign>
activity uses the created transformation:
Note that JDeveloper has added the <bpelx:annotation>
activity, which could be omitted and is JDeveloper specific. Also note that JDeveloper uses ora:doXSLTransformationFromDoc()
, which is a JDeveloper-specific function. However, as it follows the same syntax, it could be easily replaced with the BPEL standard bpel:doXslTransform()
function. To make your code portable on different BPEL run time environments, avoid using vendor-specific syntaxes or functions.
It's your turn now to deploy and test this process and compare the results with the previous implementation. Note that the results should be equal.
With this, we have concluded our discussion on variables and data manipulation.
Q1. Which activity do you use to declare a variable?
<variables>
<variable>
Q2. Which variable types are supported in BPEL?
Q3. Write the declaration of a message type variable named BookStoreWithLowestQuantity
using the message type client:BookstoreBPELResponseMessage
.
Q4. Write the code to copy BookstoreAResponse
variable to the BookStoreWithLowestQuantity
variable. Assume that both variables are of the same message type. Do not use expressions.
Q5. Which operator is used to access BPEL variables from expressions?
/
$
.
:
Q6. Which activity is used to validate variables?
<validate>
<validateVariable>
<doValidate>
Q7. Which function in BPEL specification is used to invoke an XSLT transformation?
ora:doXslTransform()
bpel:doXslTransform()
bpel:doXslTransformForDoc()