Swordfish Documentation: Designing BPEL Eclipse BPEL Designer

From Eclipsepedia

Jump to: navigation, search

Contents

Creating BPEL Process Skeleton

  1. Select File > New Wizard > BPEL 2.0 > BPEL project to create a new BPEL project and name it, FlightBooking.
  2. Next, create a BPEL file by selecting New Wizard >BPEL 2.0 >New BPEL Process File. In the BPEL file wizard window enter:
  3. Open the newly created FlightBookingProcess.bpel with BPEL Designer by double clicking it. You can now see a visual representation of an empty BPEL process as shown in this figure.
    Empty-bpel.png
  4. Expand the BPEL elements palette by clicking the arrow icon highlighted in this figure:
    Bpel-element-palette.png
  5. Using the Element Palette, create an initial BPEL Process Skeleton as displayed in this image:
    Bpel-process-skeleton.png

Setting Up BPEL WSIL Browser

To create a Partner Link to an external Web service and expose the BPEL process as a Web service we need a set of corresponding WSDL files. In the current tutorial, those files can be accessed from the Swordfish Registry.

  1. Start Swordfish Service Registry, [download]) and install the 3 WSDL files:FlightBooking.wsdl, FlightReservation.wsdl, and PaymentProcessing.wsdl. The Service Registry automatically provides a WSIL file for the installed WSDLs. The default URL is http://localhost:9001/registry/wsil, as shown in this figure.
    Wsil.png
  2. In order to access and import the above mentioned WSDL files initialize BPEL WSIL Browser. To do this select Preference > BPEL > WSIL Brower and set "Document URL" field as http://localhost:9001/registry/wsil.
  3. Click OK.
    Init-wsil-browser.png
  4. IMPORTANT: Service Registry should be up and running in the next phase, that is, the design and process execution phase.

Creating Partner Links

In the newly created process diagram we have one receive-type element (with same name "Receive") and two invoke-type elements ("processReservation" and "paimentProcessing"). For the Receive-type element we need InBound endpoints and for the invoke-type we need to create OutBound endpoints. To create Partner Links we need to import the corresponding WSDL file to the BPEL process.

Creating Receive-InBound Partner Link

  1. Click on the Receive element in the BPEL diagram. Open theProperties view and click the Details tab. You should see an empty Partner Link and Operation Fields item. Expand the Partner Link drop down list and choose the Create Global Partner Link item:
    Parnter-link-field.png
  2. In the New Partner Link window, type FlightBooking.
  3. In the next window, the option Choose Partner Link Type will be empty by default. To see the available types we need to import the corresponding WSDL files. Click on Add WSDL.
    Empty-choose-partner-link-window.png
  4. In the Browse for a WSDL to Import check the WSIL button. If your Swordfish Registry is up and running, and the BPEL WSIL Browser is set up correctly, you should see the Inspection tree including all 3 WSDL files. For this step you need to click on 'FlightBooking.wsdl' and click OK.
    Choose-flight-booking-wsdl.png
  5. Repeat the previous step for the 'FlightReservation.wsdl' and 'PaymentProcessing.wsdl' files.
  6. Now your New Partner Link window should look similar to the image shown next.
  7. Click the 'FlightBooking' item in the Matches area and click OK.
    Choose-partner-link-fool.png
  8. In the next window set Partner Link Type Name with the same value as Partner Link Name: 'FlightBooking'.
  9. Click OK to go to the next step of partner link type creation window.
  10. In the next window, enter 'InBound' for the Role Name field and select FlightBooking port type from list below(see image).
  11. Click Finish.
    Create-parther-link-type.png
  12. Leave the options in theSet Namespace Prefix window fields as it is.
  13. After you finish creating the partner link go back to BPEL diagram and check your changes:
    1. The new Partner Link 'FlightBooking' is now visible in the BPEL process sidebar
    2. In the properties pane 'Receive' element Partner Link should become initialized with just the created partner link name.
    3. In the properties pane for 'Receive' element, Operation link is still empty.
    Properties-and-new-partner-link.png
  14. We still need to set Operation field for 'Receive' element. The easiest way do to this is to click on the flightBooking operation icon within the Quick Pick element tree. Now, you can also see that the new process variable 'FlightBookingRequest' that has been automatically created and assigned to a current partner link:
    Set-operation-and-new-variable.png

Creating flightReservation OutBound Partner Link

Select the flightReservation element in the BPEL Designer to edit its properties and repeat the same set of steps as described in the previous section.

Note:

  • Partner Link Name and Partner Link Type Name should be FlightReservation
  • Partner Link Role Name should be set to 'OutBound'
  • Operation name for FlightReservation partner link is reserveFlight.

Creating paymentProcessing OutBoing Partner Link

Select paymentProcessing element in BPEL designer to edit its' properties and make same set of action as above.

Note:

  • Partner Link Name and Partner Link Type Name should be 'PaymentProcessing'
  • The Partner Link Type Role Name should be set to 'OutBound'
  • The operation name for PaymentProcessing partner link is paymentProcessing

Creating Reply Partner Link

Select paymentProcessing element in BPEL designer to edit its' properties. No Partner Link creating needed this time, we will use existing FlightBooking partner link. Set Properties pane values as on image below.

NOTE: After you set the operation value, a new variable 'FlightBookingResponse' should be automatically created.

Reply-partner-link.png

Assign-type elements initialization

Assign elements using the transit data from one BPEL logic element to the next.

In our case we have the following scenario:

  • pass initial request data from Receive element to flightRecervation element (Assign)
  • pass flightReservation element's response to paymentProcessing element (Assign1)
  • pass paymentData element's response to Rely element (Assign2)

Initialization of the first Assign Element(element name: 'Assign')

  1. Click on the Assign element on the top of the BPEL diagram and open Properties >Details tab. It will be empty by default.
    Assign-properties-empty.png
  2. click on New to create a new assign statement. This will populate From and To variables trees.
    1. Expand the 'FlightBookingRequest' item from From list (left side) and select parameters: bookFlight > flightData: FlightData item.
    2. Expand the 'FlightReservationRequest' item in theTo list (right side) and select parameters: reserveFlight > flightData: FlightData item
    Assign-variable-to-variable.png
    We have now just created a Variable to Variable assignment. It passes the initial request to the FlightReservation service. But FlightReservationRequest variable need additional initialization before assignment execution can be completed. The BPEL Designer is responsible for generating this initialization part automatically. However, there are some prerequisite steps to be done before this can work.
  3. Click on some empty area in the process diagram pane. You should then see this pop-up:
    Assign-initialization-request.png
  4. Click OK and go back to Assign Properties >Details tab. You should see that there is a new "Fixed Value to Variable" assignment.
    Assign-fixed-value-to-var.png
  5. This statement assigns the XML-string to FlightReservationRequest before "Variable to Variable" assign statement execution starts. Wee need this to create a well-formed request to the Flight Reservation service. Now your first assign element initialization is done!

Initialization of the second Assign Element(element name: 'Assign1')

The same set of actions as for first assign elements must be performed but with different variables:

  • From FlightBookingRequest->paymentData
  • To PaymentProcessingRequest->paymentData
  • IMPORTANT: don't forget about additional initialization using 'Fixed Value to Variable' statement auto generation

Assign1.png

Initialization of the third Assign Element(element name: 'Assign2')

Now you need to do the same set of actions as for first assign elements. However, once again the variable are different:

  • From PaymentProcessing->response
  • To FlightBookingResponse->response
  • IMPORTANT: Do not forget about the additional initialization using the 'Fixed Value to Variable' statement auto generation function.
  1. Assign2.png

NOTE: You can now use this process.

The resulting artifacts are:

  • FlightBookingProcess.bpel
  • FlightBookingProcess.bpelex

Now those files ready for packaging and deployment.

Swordfish Documentation Home
Swordfish Wiki Home