Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: for the plan.

Jump to: navigation, search

SMILA/Documentation/HowTo/How to filter and access record data in BPEL

This tutorial shows how to add record attributes to a BPEL workflow object and read or write them. Note that this procedure is only necessary if you want to make record data available for being used in BPEL, e.g. to evaluate conditions in the BPEL pipeline or to pass data to external webservices. It is not required for the usage of pipelets.

Adding record data to the BPEL workflow object

Because the workflow object contains the record IDs only, it is not possible by default to access the data contained in a record. However, you can configure the blackboard service to add particular attributes and annotations to the workflow object to make theme available for being used in BPEL. This is achieved by providing the file org.eclipse.smila.blackboard/RecordFilters.xml in the global configuration folder and defining a filter named workflow-object that lists all attributes and annotations that you want to have access to in BPEL. The name of this filter is defined by the record.filter parameter set in the configuration file of the processing service found at org.eclipse.smila.processing.bpel/ If you wish to write data to attributes you will have to add them to the filter likewise.


The following listing shows an exemplary configuration of the file RecordFilters.xml. It adds a couple of attributes (e.g. Filename, Path, LastModifiedData, ...) to the workflow object. For some of the attributes the keepAnnotations parameter is set to "true" to define that the object should include the annotations of the corresponding attribute too.

  <Filter name="workflow-object">
    <Attribute name="Filename"/>
    <Attribute name="Path"/>
    <Attribute name="LastModifiedDate"/>
    <Attribute name="Url"/>
    <Attribute name="Title"/>
    <Attribute name="Extension"/>
    <Attribute name="Size"/>
    <Attribute name="MimeType"/>

Using records in BPEL

Next to the configuration of the attribute/annotation filter mentioned above, you will have to make sure that the following requirements are met if you wish to access records in BPEL:

  • The XML namespaces for processor and record must be defined.
  • The processor processor.wsdl must be imported.
  • A variable (e.g. request) must be defined that contains the ProcessorMessage.

Here are the corresponding XML snippets:

<process ...  xmlns:proc="" xmlns:rec="" ... >
  <import location="processor.wsdl" namespace=""
    importType="" />
    <variable name="request" messageType="proc:ProcessorMessage" />

Provided that you added the filter configuration and ensured the requirements above it is possible to access records and their contents via the variable request. This variable contains an array of records. Each record can be accessed via its index number (starting at 1). So to be able to process all records, you will have to wrap the record access and execution of any business logic in a loop.

Here are some templates to access (read or write):

  • an attribute value: $<variable>.records/rec:Record[position()=<index>]/rec:Val[@key="<Attribute-Name>"]

For more details on the XML schemas and the WSDL see the files id.xsd, record.xsd, and processor.wsdl in the folder configuration/org.eclipse.smila.processing.bpel/pipelines.


Reading an attribute

The value of the attribute Title is read from the first record and stored in the variable input.param.

<assign name="copy-attribute-to-variable">			

Writing an attribute

The value of the variable response.param is stored in the attribute Title of the second record.

<assign name="copy-variable-to-attribute">

Note that in standard BPEL the target element that you want to write data to, must already exist before text can be stored in it, thus it is not possible to add new attributes, literal, and values to the workflow object this simply.

Examples in SMILA source code

Have a look at the pipelines of the standard configuration in SMILA.application/configuration/org.eclipse.smila.processing.bpel/pipelines or the test pipelines in bundle org.eclipse.smila.processing.bpel.test/configuration/org.eclipse.smila.processing.bpel/pipelines. You can find lots of examples for usage of BPEL control structures and XPath queries in there.

Back to the top