Two weeks ago, during the first session of our 3-month SOA Training program, we worked very hard on XML (and XSD, XPath and XSLT). Today, this starts to pay off: we are entering the world of Business Processes and their implementation through the Business Process Execution Language, or BPEL for short. This session is led by Peter – who managed to find some time between the two SOA projects he is currently working on.
He introduced BPEL, with a strong focus on the Process character. However
, he was quick to point out that the boundaries between process and service are not very well defined with BPEL. It is easy to implement very short lived, synchronous BPEL ‘processes’ that have a little logic, invoke some (web) services, do some transformations and return a value. Such processes are really nothing more than fancy web services, easily created thanks to the programming facilities in BPEL and the easy integration with partner links. Ideally, we would use an Enterprise Service Bus at the this low end of the Services scale.
However, when the BPEL process is longer lived – up to months or years -, typically asynchronous in nature, possibly with some human interaction and possibly initiated by a business event, not necessarily a direct call from some service consumer, and most importantly reflecting a true business process that our business users actually define and live, we can really consider it a process.
The power of BPEL lies in the modeling and execution of processes, very closely defined to real business processes. Most of the technical nature of the service implementations is pushed behind the interfaces of these services. The WSDL defines these interfaces and is easily integrated in the BPEL process through the PartnerLinks in BPEL. The process consumes the services – and can consider them in a very functional way: what goes in, what comes out, what exceptions can occur.
Process (definition) and (Process) Instance
One of the things important to realize is the distinction between the Process (definition) and the (process) Instance. During Design time, when we speak of the BPEL process, we really talk about the XML document that specifies the process, the meta-description that feeds into the BPEL process manager. When the process has been deployed, the blue print for process instances is loaded and ready for action in the BPEL engine. As soon as the process is initiated, through a direct call or a business event the process listens for, a new instance of the process is created. Additional calls will make the engine initiate additional instances of the same process, based on that blue print: the process definition. While the process definition – an XML file – lives on the file system of the application server, the process instances are dehydrated (stored) as records in a database. Each instance is a row in a table.
An example of a process is ‘Patient makes an appointment to see the doctor’. An instance of that process would be ‘Mrs. Jones called this morning to make an appointment for tomorrow morning to come in and see Dr. Nuijten’. Other instances refer to other patients, doctors and appointments. Each instance has its own set of data – that is kept within the process.
Process Activities
Peter introduced BPEL from the top: discussing the (possible) role of BPEL in SOA, discussing the interface BPEL presents to the world and the interaction a BPEL process can have with external parties. He then discussed the Activities – the programming constructs if you like – in the BPEL process definitions. Activities can be clustered in various categories:
- interaction – Receive, Reply, Invoke, (User Task), Pick (plus the onEvent, onMessage and onAlarm event handlers)
- structure – Scope, Sequence, Flow, FlowN
- programming logic – While, Switch ,Terminate, Wait, Catch, Throw
- data manipulation – Transform, Assign
- miscellaneous – Java Embedding, Empty
My First BPEL Process
After this first introduction, it was hands-on time. The homework assignment for this session was for each participant to install the Oracle 10g (10.1.3.3) SOA Suite on the Virtual Machine Peter had made available two weeks ago. Everyone had managed to get the SOA environment up and running. Now creating the first BPEL process – yes, HelloWorld! – was dead easy. A synchronous process, input String and output String, with the message and type definitions included in the WDSL and the XSD imported into the WSDL, both created for this BPEL process.
Peter made a very thorough walk through of this simplest of BPEL process. He discussed the .bpel and .wsdl file created by JDeveloper for the BPEL process and pointed out the XSD created for the BPEL process. He discussed the variables – input and output – and the messages and types they are based on. He then showed how the Assign activity can be used to initialize and manipulate variables. He told the audience that the operations Append (add to a container that may not contain anything at this point), Insert After, Insert Before, Copy List, Remove and Rename are Oracle specific additions over the BPEL standard – very useful additions at that!
Our lessons in XPath from two weeks ago then proved very useful when Peter discussed the Expression Builder used for example for creating the XPath expressions used to query data from the source BPEL variables to put on the target. Just before dinner, the first BPEL processes were humming and buzzing on all students’ machines.
Resources
In addition to the training material only available on our internal WIKI, there is a lot of material on BPEL in general and Oracle BPEL PM in particular. See for example the Oracle 10.1.3 BPEL PM Quick Start Guide.
Links can be found on our corperate website http://www.amis.nl/de-agenda
There arnt any trainings scheduled at this moment. But keep an eye out in the near future 😉
Pls provide us the link to register for these trainings….
would you be posting the xsd/xpath/xslt training materials ..here ?