Custom variable types are variables that contain a set of fields related to a specific object. For example, a custom variable type for a Customer object would be made up of the fields First Name, Last Name, Account ID, Phone Number, and so on.

A collection is a type of user variable that contains a list of items. Simple collections contain values of the same data type (e.g., a list of numbers). Object collections contain a list of items (objects) that are each made up of a set of fields. 

This section explains how to map responses from the web service into custom variable types and collections. As an example, we will use a web service that returns a list of key-value pairs. First, we will create a new custom variable type (object) that contains two fields (key and value). To retrieve a single key-value pair, the relevant pair is mapped to this object. To retrieve all the pairs, the responses are mapped to a collection of key-value pair objects.

Note: The procedures below are based on the XML response shown above, and relate only to creating response parameters. For details about the end-to-end flow for creating a new Integration Point, refer to Adding a SOAP Integration Point.

Mapping to a Custom Variable Type

The following procedure shows how to map the first key-value pair in the response to a custom variable type (object). The procedure also demonstrates how to use the New Custom Type option, a feature that enables you to add a custom variable type created specifically to hold the data returned by a web service.

To map the first response value to a custom variable type:

  1. In the XPath field, enter the appropriate XPath:
    /GetAllMappingsResponse/values[1]
  2. From the Variable Type dropdown list, select New custom type.
    The Create button appears to the right of the dropdown list.

  3. Click Create.
    The Create custom variable response popup opens. The path and the key (an identifier for the field) are automatically populated, based on the XML response.

  4. In the Type Name field, enter a relevant name for the custom variable type (e.g., keyvaluepair). 
  5. If desired, in the Alias fields, update the default values to appropriate friendly names. The settings defined here are displayed in the Interaction Designer. 
  6. Click Create.
    The Create custom variable response popup closes, and the name of the new object appears in the Variable Type field.
  7. Click Evaluate.
    Response results are displayed in the XPath Evaluation Result popup.

  8. In the Variable Name field, enter a meaningful name for the custom variable type. The name assigned here is the one displayed to users in the Interaction Designer.

Mapping to a Collection

The following procedure shows how to map all the key-value pairs in the response to a collection of keyvalue objects (the object that was created in the previous procedure).

To map the response values to an object collection:

  1. In the XPath field, enter the appropriate XPath:
    /GetAllMappingsResponse/values
  2. From the Variable Type dropdown list, select Collection.
  3. Click on the field to the right of the words of type, and from the options menu, select the custom variable type created to hold key-value pairs.

  4. Click Evaluate.
    Response results are displayed in the XPath Evaluation Result popup.

  5. In the Variable Name field, enter a meaningful name for the variable (e.g., key-value list). The name assigned here is the one displayed to users in the Interaction Designer.

Revision:

Comments