Show TOC

Procedure documentationMapping a Service Operation's Input and Output Locate this document in the navigation structure

 

You can define how the data coming from one service operation as input in the service flow has to be mapped (that is, you define what will be its output) in the service flow. You can directly define how the data from one data structure is mapped to another data structure. To do that, you use the mapping's editor of the service operation. In the mapping's editor the source data (that is, the source context) is displayed in the left-hand side tree while the target data structure (that is, the target context) is displayed in the right-hand side tree. You have to drag and drop (that is, map) nodes from the source context to nodes from the target context. Each data mapping represents a specific data transformation.

If you call a composed service operation at runtime, it results in multiple data mapping transformations according to the defined incoming flow connections – one mapping per incoming flow connection. When mapping a service operations input and output, note the following:

  • Data mapping should be explicitly defined for each service operation.

  • Data mapping should be explicitly defined for the operation's output.

  • Each service operation or operation's output can have exactly one data mapping definition.

  • Parallel splits, parallel joins, flow connectors, and the operation's input do not have assigned data mappings.

  • You can directly define static values for a target data structure, if you need to.

  • You can use different functions to be executed during data transformation. You can define your own functions or use built-in functions.

Mapping Assignment Options

Depending on the nodes type and their cardinality, you can define the following mapping assignment options:

  • Set

    Set is the default assignment for both node types. When you use the set option, the source context overrides the target context.

    Example Example

    In the source context object, you have one element and the target object is a list containing five elements. When you use the set option, after the mapping you have one element.

    End of the example.
  • Append

    The append option is available for both node types if the maximum occurrence is greater than 1. When you use the append option, the source context objects are appended to the list of existing target context objects.

    Example Example

    In the source context object, you have one element and the target context object is a list containing five elements. When you use the append option, after the mapping you have six elements.

    End of the example.
  • Merge

    The merge option is intended for structured target data. When you use the merge option, the source context objects are merged with the target context objects. New objects are created in the target object if the number of objects in the source object is greater than the number of objects in the target object.

    Example Example

    In the source context object, you have a list containing five nodes A, B, C, D, and E. In the target object you have a list containing two nodes M and N. When you use the merge option, after the mapping you have a list with the following nodes: M, N, C, D, and E.

    End of the example.
Assigning Static Values to Target Data Elements

For more information about how to assign static data values to a target data element, see the section Assigning Static Values to Target Context Nodes in Data Mapping Rules.

Procedure

Orchestrating Data Mappings
  1. Select a service operation's diagram element - either a service operation or the operation's output for which you want to perform the data transformation.

  2. Open the Properties view.

    To do that, from the menu path choose   Window   Show View   Other...  . Choose   General   Properties   and choose OK.

  3. Open the Mapping tab page.

  4. To create data mapping, drag and drop elements from the source tree to elements in the target tree.

  5. In the context menu of the mapping line, choose Assignment and then select one of the available assignment options depending on the mapping you want to define.

  6. Save the file.

    From the menu path, choose   File   Save  .

Using Functions for the Data Transformations

You can create and apply different functions over the data context:

  • Expressions functions

  • Mapping functions

  • EJB Functions

For more information about how to create, use and edit expressions and different types of functions, see:

Combining Multiple Source Values in a Single Target Data Element

You can perform complex data transformation procedures such as mapping multiple data sources into a single target element. For example, you can map two separate sources of data into a single input and apply an expression that handles the logic of the import.

Note Note

Note that if you want to map collections of complex elements, first you have to map their corresponding parent elements.

End of the note.
  1. From the menu path, choose   Window   Preferences  . In the dialog that appears, choose Service Composer.

  2. To be able to view the outputs of all services that are called before the service operation you want to modify, select the Display all predecessors in flow modeling checkbox.

    Apply the settings and close the dialog.

  3. In the mappings editor, map the desired service outputs to the single service input.

    Caution Caution

    When composing a service, you cannot define mappings from identical services when they point to the same target. The reason is that the identical services have the same data structures, so you can map the output of only one of the services. To resolve this, make a wrapper service of one of the identical services - that is open the service for simplification without doing any simplifications and then save it.

    End of the caution.
  4. Open the expression editor and apply the expression that you want to use to represent the logic behind this mapping.

  5. Save the file.

    From the menu path, choose   File   Save  .

More Information

For more information, see Applying Quick Fixes in Data Mappings and Expressions.