Script activities are used to run inline Java code as an activity of the process. The Java code can access all BPEL variables, correlation properties, and partner links, as well as process and activity contexts.
You can also use inline Java code for conditions. Each Java code snippet for activities or conditions is run in its own Java method. These methods belong to an enterprise bean that is created for the process. The run-time environment of the Java code is the Java 2 Platform Enterprise Edition (J2EE) environment of regular Enterprise JavaBeans (EJB).
<bpel:invoke ....> <wpc:script> <wpc:javaCode> EObject myCustomer = getPurchaseOrder().eGet("customer") ; EObject account = getAccount() ; account.eSet("ID", myCustomer.eGet("accountID") ) ; setAccount(account) ; </wpc:javaCode> </wpc:script> <!-- standard activity elements go here --> </bpel:invoke>
<bpel:while> <wpc:condition> <wpc:javaCode> return getCounter().getValue() > 0 ; </wpc:javaCode> </wpc:condition> <!-- loop activity goes here --> </bpel:while>
Parent topic: About business processes