Table of Contents

Search

  1. Preface
  2. Part 1: Using Process Developer
  3. Part 2: Creating and Modifying Processes
  4. Part 3: Functions, Events, Errors, and Correlation
  5. Part 4: Testing and Deployment
  6. Part 5: Process Central and Process Server (On-Premises)

Process Developer

Process Developer

Writing XQuery Functions

Writing XQuery Functions

Process Developer integrates the XQuery Development Tools (XQDT) project. Using it, you can create XQuery custom functions in your orchestration project that are automatically included in the functions list of the Expression Builder.
XQDT includes an XQuery editor with syntax highlighting, validation, content assistance, and execution support. You can easily create and test XQuery functions in the editor before using them within the Process Developer Expression Builder. Also, you can make changes to a function and save it. The updates are automatically included in your BPEL file.
Each function must be part of a library module in order for it to be included in the Expression Builder. You can create a module of functions in one XQuery file and then use the functions defined in that module in any other XQuery by using the
import module
directive.
XQDT supports XQuery 1.0 and many XQuery 3.0 constructs.
After you double-click in the functions section of the expression builder to add an XQuery function, the XQuery file is added as an import. You should pay attention to what XQuery files are referred to as imports in the BPEL process and make sure that there are no duplicates between that list and what they explicitly add as imports in the XQuery files that use the import module.
If you have an existing project (prior to version 9.0), right-mouse click on the project in the Project Explorer, and select
Add XQuery Nature
.
To get started creating an XQuery function:
  1. Right-mouse click on the
    xquery
    folder (or another folder) in your orchestration project, and select
    New > XQuery Module
    .
  2. Name the file with a
    .xq
    extension, such as
    myNewFunctionModule.xq
    .
  3. Select one of the following:
    • Main module. Contains a query body to be evaluated
    • Library module. Contains a module declaration but no query body. A module declaration provides a URI that identifies the module for imports. Enter a prefix and namespace for the module declaration.
  4. Select
    Finish
    , and the XQuery editor opens. Use content assist (Ctrl + spacebar) to begin a new function.
The following example shows the module declaration for a library module. This declaration is required for an XQuery function to appear in the Functions list:
(: The version declaration in line one is optional. Version 1.0 does not allow any use of version 3.0 constructs. :)
xquery version "1.0" encoding "utf-8"; module namespace xqf= "TechSupportLevel1"; declare function xqf:pingModemResult ((: $param as type, ... :)) as item() { insert_an_expression_here };
Once you save your XQuery file, the function is automatically available in the Expression Builder, as shown.
As you use a function, the corresponding XQuery module is automatically added to the process's Imports node.
Tip
: In the Outline view, select the function under Imports to view its properties. If you run B-unit tests, you can add the XQuery modules as a resource and specify the Type URI as shown.
See also:

0 COMMENTS

We’d like to hear from you!