This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

XML and JSON Support Sample

Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation:

  • <PRODUCT_HOME>/repository/samples/ directory that includes all Business Process profile samples and their artifacts is changed to <EI_HOME>/samples/business-process/.

The .bar file relevant for this sample is XMLVariableTypeUsageProcess.bar.

Flow of the sample

This sample is based on a bookstore to handle pending arrivals of books.

  1. Get the list of pending arrivals..
  2. If there are no pending arrivals, a message stating "No Pending Arrivals" is printed.
    If there are pending arrivals, a user task is triggered and assigned to the admin to add a new book.

    The following code snippet shows the above condition using the XML variable. 

    {xmlDoc.xPath("/bookstore/pendingArrivals/text()") > 0}
  3. The new book is added to the book list.
  4. The last service task prints the book list.

Deploying and running the sample

  1. Login to the management console as the admin, using admin/admin credentials.
  2. Navigate to Processes > Add > BPMN and upload the XMLVariableTypeUsageProcess.bar file found in the <BPS_HOME>/repository/samples/bpmn/ directory.
  3. Login as admin on the BPMN explorer using admin/admin credentials.

  4. Select the Processes tab and start a two process instance of the XMLVariableType process; one with the Pending Arrivals Count field set to 0 and another one with the Pending Arrivals Count set to 1.
  5. Select Tasks>My Tasks tab and you will see that the process instance you started with a pending arrivals count of 1 will appear on the task list as a user task.