Editing a BPEL process

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (96)

View Page History
{section}
{column}

h1. Introduction

When you want to create a BPEL process to run in Petals, you must first create a BPEL Sketch project.
A [sketch project|Working with Croquis (or Sketches)] aims at easing and speeding up the creation of a BPEL process for Petals, by making some Petals constraints invisible.

\\
This page illustrates the three ways to create a BPEL Sketch project.

{info}
*Level:* Easy
*Estimated time:* 5 minutes the first time, 1 minute then
*Expected skills:* \-
{info}
This page explains the capabilities the studio offers to edit a BPEL process.
In particular, it introduces the main features of the Eclipse BPEL Designer and the studio's validation for BPEL.
{column}
{column:width=350px}
{section}

h1. Introducing the BPEL Designer

h1. Creating a new empty BPEL process
The BPEL Designer embedded in the studio is a modified version of the official Eclipse BPEL Designer.
The layout is a little bit different, and some bugs were fixed as well.

In the menu, select *File > New > Sketch Project*.
If you do not see it, go into *File > New > Other...* Then, select *Sketch Project* under the *Petals* category.
!petals-studio-edit-bpel-1.jpg!

!petals-studio-create-bpel-sketch-1.jpg!

\\
A wizard opens, showing three drop-down lists.
In the *Use Case* combo, select *Use a Petals technical service*.
In the *Petals Component* combo, select *BPEL // petals-se-bpel*.
In the *Component Version* combo, select the version of the Petals-SE-BPEL that you are using in Petals.
The designer is made up of two tabs: one displays a graphical view of the process, while the second one shows the source code of the BPEL.
The graphical tab is divided ino three parts:
* The *palette* can be used to select activities to insert on the diagram, or to change UI settings (e.g. the zoom or the mouse icon).
* The *diagram area* is the main area and shows the processing flows.
* The *dashboard* lists non-visual elements of the BPEL process, such as variables and partner links (the BPEL Designer does not make them visible in the diagram).

!petals-studio-create-bpel-sketch-2.jpg! !petals-studio-edit-bpel-2.jpg!

In the scope of this page, we will use the version 1.0 of the component.
Click *Next*.

\\
On the next page, select *Create a new BPEL process*.
The source tab uses the Eclipse XML editor.
BPEL XML schemas have been registered in the XML catalog, so that contextual help (Ctrl + L) can propose mark-ups and attributes to insert.

!petals-studio-create-bpel-sketch-3.jpg! !petals-studio-edit-bpel-3.jpg!

Click *Next*.
h1. Adding activites in the process

\\
The next page expects the project name.
This name will also act as the process name.
Activities can be added on the diagram by 2 means:
* You can either select an activity in the palette (by clicking it), and then clicking your diagram at the location where this activity should be added.
* Or, you can right-click a diagram element and use the *Add* or *Insert Before* actions.

!petals-studio-create-bpel-sketch-4.jpg! !petals-studio-edit-bpel-4.jpg!

Click *Finish*.
h1. Creating a new partner link

\\
The sketch project is created.
It contains a basic BPEL process...
A partner link represents a service to invoke. It is associated with a PortType (a WSDL interface) and with roles in the process.
To create a partner link, click the "+" symbol located next to *Partner Links* category in the dashboard.
Give the new partner link a name. A convention may be to taking the port type (interface) name with "Partner" as the suffix.

!petals-studio-create-bpel-sketch-6.jpg! !petals-studio-edit-bpel-9.jpg!

\\
... with a WSDL definition and an Artifacts WSDL.
Now, import the WSDL of the service / partner link in the project.
You can either try a manual copy, or use the [import wizard available in the studio|Importing a WSDL Definition].
Because WSDL definition may draw several file dependencies, it is better to create a sub-directory to place the imported files.
This WSDL must be the definition of the service to invoke. It will be associated with the new partner link.

!petals-studio-create-bpel-sketch-5.jpg! \\
Then, go in the *Properties* view, under the *Details* tab.

!petals-studio-edit-bpel-10.jpg!

h1. Starting from an existing BPEL
\\
Click *Browse...*. A dialog shows up.
It shows available port types. If the one you target is not there, click *Add WSDL*.

!petals-studio-edit-bpel-11.jpg!

In the menu, select *File > New > Sketch Project*.
If you do not see it, go into *File > New > Other...* Then, select *Sketch Project* under the *Petals* category.
\\
Another dialog shows up. Use it to select the WSDL you imported in your project.
Be careful if you take a WSDL located outside the project. Imports may be expressed through a relative URL.
Once you have picked up a WSDL, click *OK*. At least one new port type should have appeared in the first dialog.

!petals-studio-create-bpel-sketch-1.jpg! !petals-studio-edit-bpel-12.jpg!

\\
A wizard opens, showing three drop-down lists.
In the *Use Case* list, select *Use a Petals technical service*.
In the *Petals Component* list, select *BPEL // petals-se-bpel*.
In the *Component Version* list, select the version of the Petals-SE-BPEL that you are using in Petals.
Select this new port type and click *OK.*
A wizard is open and asks for the properties of the partner link.
The first page asks for the name of the partner link type. Generally, it is the port type name, followed by "PT".

!petals-studio-create-bpel-sketch-2.jpg! !petals-studio-edit-bpel-13.jpg!

In the scope of this page, we will use the version 1.0 of the component.
\\
Click *Next*.
On the next page, select the port type to use, and type in a role name for the partner link.

!petals-studio-edit-bpel-14.jpg!

\\
On the next page, select *Import an existing BPEL process*.
Indicate the BPEL URL, or use the *Browse...* button to select the BPEL file on the local disk.
Click *Next* if you want to define a second role, or *Finish* if one is enough.
This action closes all the dialogs.
Sometimes, there can be another one about name space mapping. It simply asks for a prefix to associate with a namespace.

!petals-studio-create-bpel-sketch-7.jpg! \\
Before saving your file, set the *MyRole* and *PartnerRole* in the properties.

Click *Next*.
!petals-studio-edit-bpel-15.jpg!

\\
The next page expects the project name.
This name will also act as the process name.
By default, it is filled-in with the name of the imported process.
Save your file to [be sure there is no error|Editing a BPEL process#Validating the process].

!petals-studio-create-bpel-sketch-8.jpg!
h1. Invoking a service

Click *Finish*.
Invoking a service in BPEL is achieved by inserting an _Invoke_ activity in the process.
Before creating an _Invoke_ activity, you need to have a partner link.

\\
The sketch project is created.
It contains the imported BPEL process...
To create the invocation, [create a new _Invoke_ activity|Editing a BPEL process#Adding activites in the process].
Give the invocation a name (generally, *invoke_<partner link name>_*) and go into the *Properties* view of this activity.

!petals-studio-create-bpel-sketch-10.jpg! !petals-studio-edit-bpel-16.jpg!

\\
... with its resources.
An invocation needs the following elements:
* The partner link to invoke (this is a qualified name).
* The operation to invoke (also a qualified name, as described in the WSDL of the partner link).
* An input variable: which XML message will be sent to the partner link?
* Optionally, an output variable. It depends on the message exchange pattern (is the operation supposed to return something?).
The output variable is used to store the response of the partner link.

!petals-studio-create-bpel-sketch-9.jpg! \\
You can fill in these fields through the properties.
Or, you can also use the *Quick Pick* box, on the right.
Select an operation: all the fields will be filled-in automatically and the required variables will be created when necessary.

!petals-studio-edit-bpel-17.jpg!

h1. Generating a BPEL from a WSDL definition
\\
Save your file to [be sure there is no error|Editing a BPEL process#Validating the process].

h1. Making assignations

In the menu, select *File > New > Sketch Project*.
If you do not see it, go into *File > New > Other...* Then, select *Sketch Project* under the *Petals* category.
Assignations are BPEL activities to elements and attribute values from one variable to another one.
They are created like [any other activity|Editing a BPEL process#Adding activites in the process].
Then, go in the *Properties* view, in the *Details* section.

!petals-studio-create-bpel-sketch-1.jpg!
Assignations are in fact a sequence of field-to-field assignations.
Affecting the value of one element/attribute to another one is one step of the sequence.
There are are many steps as required to have completed the second variable.

\\
A wizard opens, showing three drop-down lists.
In the *Use Case* list, select *Use a Petals technical service*.
In the *Petals Component* list, select *BPEL // petals-se-bpel*.
In the *Component Version* list, select the version of the Petals-SE-BPEL that you are using in Petals.
Here is an example of assignation.
First, the variable to assign is initialized with a XML content that matches its type.

!petals-studio-create-bpel-sketch-2.jpg! !petals-studio-edit-bpel-18.jpg!

In the scope of this page, we will use the version 1.0 of the component.
Click *Next*.

\\
On the next page, select *Generate a BPEL skeleton from a BPEL file*.
Indicate the WSDL URL, or use the *Browse...* button to select the WSDL file on the local disk.
Once this is done, you can select the _Port Type_ that will be used as describing the BPEL service.
And then, an element value from a previous variable is copied into an element of the variable to assign.

!petals-studio-create-bpel-sketch-11.jpg! !petals-studio-edit-bpel-19.jpg!

Click *Next*.

\\
The next page expects the project name.
This name will also act as the process name.
By default, it is generated from the WSDL name.
{tip}
To ensure the portability of your BPEL process, and to avoid issues at runtime, you should always initialize your variables.
This is in particular true for optional elements, taht cannot always be created automatically.
{tip}

!petals-studio-create-bpel-sketch-12.jpg!
h1. Validating the process

Click *Finish*.
BPEL files that are contained in Service-Unit projects and in BPEL croquis are automatically validated on every modification.
It is also possible to explictely validate a BPEL file by right-clicking it and selecting *Petals > Validate BPEL*.

!petals-studio-edit-bpel-5.jpg!

\\
The sketch project is created.
It contains a BPEL process that was generated from the WSDL definition...
Note that this validation is based on the same validation mechanism than the Petals BPEL engine.
There are additional validation rules than in the usual BPEL Designer.
Errors and warnings are visible in the *Problems* view...

!petals-studio-create-bpel-sketch-13.jpg! !petals-studio-edit-bpel-6.jpg!

{info} \\
The process on this last picture may seem unusual.
In fact, the WSDL definition contains a lot of operations.
To make it readable, the BPEL designer switched to the horizontal layout.
{info}
... on the diagram...

!petals-studio-edit-bpel-7.jpg!

\\
... with the imported WSDL definition and an Artifacts WSDL.
... and in the source view.

!petals-studio-create-bpel-sketch-14.jpg! !petals-studio-edit-bpel-8.jpg!