This chapter contains the following recipes:
SessionBean
from the BPEL processThe BPEL specification defines a finite set of activities. One of the options is to define our own functional activity via the Java Embedding activity. With the Java Embedding activity we can define any behavior in Java programming language. The Java Embedding activity can be used when we have some Java code that performs some small scale task, while we don't want to develop the complete solution as the Java application.
Inside the Java Embedding activity, we can use standard Java classes, methods exposed by the BPEL environment, and user defined extension classes. We will see this in this chapter. We can call it a session EJB3 bean.
From inside the Java Embedding activity we can access BPEL process variables. With an appropriate method, we can read variable content and set it as well. The activity provides us with methods to put a query in the BPEL process information.
In general, we use the Java Embedding activity to execute a small piece of the code. It is not intended to be used for business logic implementation. When we need to implement large business logic, it is recommended to develop the web service and then utilize it from the BPEL process.