Skip to main content

Uniphore Customer Portal

Using Advanced Variable Types in SOAP IP Responses

Typically, SOAP data that is received from a web service is returned in structured form, so it's often useful to map a SOAP response into an advanced variable type.

This article provides details on how to map X‑Platform advanced variable types when defining SOAP responses, including:

  • Custom Types. Multiple variable types that use a set of fields relating to a specific object. For example, a Custom Type for a Customer object might be made up of the fields First Name, Last Name, Account ID, Phone Number, Contact Date, etc.

  • Collections. 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.

  • Dynamic Variables. A variable that consists of a JSON object, enabling its content to be changed anytime to suit the current data needs of a Flow.

For details on using simple variable types in SOAP responses, click here.

Mapping to a Custom Type

For our example, we'll use a web service that returns a list of key-value pairs. We'll create a Custom Type containing two fields (key and value) to store these responses. To retrieve a single key-value pair from the responses, the relevant pair is mapped to this Custom Type. To retrieve all of the key-value pairs, we'll map the responses to a Collection of these Custom Types, as detailed here.

SOAPMapping-Example_200721.png

Note

The procedure below shows how to map the first key-value pair in the response to a newly-created Custom Type. You can also select and use an existing Custom Type, but be sure to verify that its fields exactly match the data that will be returned by the SOAP response.

  1. Invoke the wizard and complete the SOAP and Request panels as required for your WSDL service.

  2. In the Response panel, click the Variable Type dropdown list, scroll to the bottom, and select New custom type.

  3. In the XPath field, enter the appropriate XPath, for example: /GetAllMappingsResponse/values[1]

  4. From the bottom of the Variable Type dropdown list, select New Custom Type. The Create button appears to the right of the dropdown list.

    SOAPMapping-NewVarCreation_200721.png
  5. 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:

    SOAPCreateCV-Example_200721.png
  6. In the Type Name field, enter a relevant name for the custom variable type.

  7. If desired, in the Alias fields, change the default values to helpful names. These values will be displayed to a user in the X-Designer.

  8. Click Create. The Create custom variable response popup closes, and the name of the new object appears in the Variable Type field.

  9. In the XPath area, next to your new Variable Type, click Evaluate. Response results are displayed in the XPath Evaluation Result popup.

    SOAPEvalResult-Example_200721.png
  10. In the Variable Name field, enter a meaningful name for the custom variable type. This name will be displayed to a user in the X-Designer.

Mapping to a Collection

The following procedure shows how to map all of the key-value pairs in the response to a Collection (in this case, keyvalue Custom Type objects we defined above).

  1. Invoke the wizard and complete the SOAP and Request panels as required for your WSDL service.

  2. In the Response panel, in XPath field, enter the appropriate XPath. For example: /GetAllMappingsResponse/values

  3. From the Variable Type dropdown list, select Collection.

  4. 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.

    SOAPCollectionOfKeyvalue-Example_200721.png
  5. Click Evaluate. Response results are displayed in the XPath Evaluation Result popup.

    SOAPEvalResultCollection-Example_200721.png
  6. In the Variable Name field, enter a meaningful name for the variable (e.g., key-value list). This name will be displayed to a user in the X-Designer.

Mapping to a Dynamic Variable

The following procedure shows how to map a SOAP response to a dynamic variable JSON object.

  1. Invoke the wizard and in the SOAP panel, use a WSDL service that returns a JSON formatted object.

  2. Complete all required parameters in the SOAP and Request panels.

  3. From the Response panel, in the XPath area, select Dynamic from the Variable Type dropdown menu:

    SOAPDynamicVarType-Example_200721.png

    Note that the XPath field will not be displayed since it is not needed.

  4. In the Variable Name field, enter a name for the dynamic variable that will receive the full SOAP response.

    Note

    When using a dynamic variable, the SOAP XML is automatically converted and stored as a JSON object.

  5. Click Evaluate to ensure that your request will return the desired response. Response results are displayed in the XPath Evaluation Result popup.

    SOAPEvalResult-Example3_200721.png
  6. Complete the wizard to finish creating the new Integration Point.

You can parse the JSON object IP response to extract the specific data that you need for the Flow. For details on using dynamic variables in Interact, refer to Using Dynamic Variables