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

This article provides details on how to use Interact 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.

This procedure 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.

  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.

  6. In the Type Name field, enter a relevant name for the custom variable type (e.g., keyvaluepair). 
  7. If desired, in the Alias fields, update the default values to appropriate friendly names. The settings defined here are displayed in the Interaction 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. Click Evaluate. Response results are displayed in the XPath Evaluation Result popup.

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

This 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, enter the appropriate XPath in XPath field, 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.

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

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

Mapping to a Dynamic Variable

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

  1. Invoke the wizard and in the SOAP panel, using 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, select Dynamic from the Variable Type dropdown menu. Note that the XPath field will be hidden in order to prevent input.
  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 is returning the desired response.
  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

.

Revision:

Comments