Retrieve Attribute from Message

Overview

The Retrieve from Message filter uses XPath expressions to extract the value of an XML element or attribute from the message and set it to an internal message attribute. The XPath expression can also return a NodeList, and the NodeList can be set to the specified message attribute.

Configuration

The following fields are available on the Retrieve from Message filter configuration screen:

Name:

Enter an appropriate name for this filter.

Attribute Location:

Configure an XPath expression to retrieve the desired content.

Click the Add button to add an XPath expression. You can add and remove existing expressions by clicking the Edit and Remove buttons respectively.

Extract the Content of the Node:

When this option is selected, the content of the XML element or attribute in the message is extracted and set to the specified message attribute.

Serialize All Nodes in the NodeList:

This option saves all nodes retrieved from the XPath expression to the specified message attribute as a String (for example, <node1>test</node1>). This option is useful for extracting <Signature>, <Security>, and <UsernameToken> blocks, as well as proprietary blocks of XML from messages.

Save as List of Nodes:

This option saves the nodes retrieved from the XPath expression to the specified message attribute as a Java List, where each item is of type Node. For example, if the XPath returns <node1>test</node1>, there is one node in the List (<node1>). The child text node (test) is accessible from that node, but is not saved as an entry in the List at the top-level.

Attribute ID:

The API Gateway sets the value of the message attribute selected here to the value extracted from the message. You can also enter a user-defined message attribute.