This topic explains how to configure and apply the XML Data Bank tool in SOAtest and Virtualize. This tool that extracts XML values (e.g., from a request or response message) so that they can be used in another place. Data can also be sent to a Writable Data Source and accessed in the Extension Tool, or it can be sent to variables for easy reuse across the test suite (SOAtest) or Responder suite or Action suite (Virtualize).
Sections include:
Table of Contents | ||
---|---|---|
|
...
The XML Data Bank tool enables you to extract certain XML values (e.g., from a request or response message) so that they can be used in another place. The XML Data Bank tool can be chained to any other tool that outputs XML. It can extract any information from the XML and make that information available for later use.
...
...
For example, you can extract a value from an incoming request and use it to populate an element of the response to be sent when that request is received. You can configure XML Data Banks automatically when using wizards to create virtual assets from traffic. In addition, you can use the "Use Data Source Wizard" to extract a value and use it as a parameterized value in a response. For Message Responders, you can extract values from the incoming request (body or header); for other tools (e.g., tools used in action suites), you can extract values from another tool in the suite. Another option is to manually add an XML Data Bank tool (as an output to an existing tool) that extracts the desired data, then configure other tools to use the extracted data.
Configuring XML Data Bank Using the Data Source Wizard
Anchor | ||||
---|---|---|---|---|
|
...
To use the "Use Data Source Wizard" wizard to configure an XML Data Bank:
...
:
...
- Product:
(
SOAVirt, Virtualize) (sv-attr:0A010204015A9054C88481D043445E2F 0A010204015CF6008A11EEF43AC91334 0A010204015A9054C88802B9600247DF Not applicable for use with Message Responders)
Ensure that you have an action set or test suite with at least two tools.
- In the configuration panel for the tool that you want use the extracted value, select one of the available Form views.
- From the Operation drop-down menu, select the operation that you want to use the extracted value.
- In the element view (for example, the id value), go to the message element that you want to use the extracted value, then select Parameterized and Use Data Source Wizard from the available drop-down menus.
- In the wizard that opens:
Select the tool you want to extract a value from
Conditional Content Product: (SOAVirt, Virtualize) Product:(
SOAVirt, Virtualize) (sv-attr:0A010204015A9054C88481D043445E2F 0A010204015CF6008A11EEF43AC91334 0A010204015A9054C88802B9600247DF for action suite tools)
. The drop-down menu at the top of the panel will contain all tools in the test or Responder suite that occur before the current tool you are configuring. For example, if you are configuring Tool 4, tools 1, 2, and 3 will display in this menu along with any data sources that may be available.
Conditional Content Product: (SOAVirt, Virtualize) Product: (SOAVirt, Virtualize) sv-attr:0A010204015A9054C88481D043445E2F0A010204015CF6008A11EEF43AC91334 0A010204015A9054C88802B9600247DF For Message Responders, select the incoming request message that you want to extract a value from, then specify whether you want to extract values from the message body or message header.
- Using the controls on the left side of the panel, indicate what you want to extract and add it to the right side of the panel. The right panel lists the values you have configured for extraction, and shows the name of the data source column where they will be stored (if you keep the default setting).
- (Optional) If you want to specify additional options (e.g., if you want to change the name of the column used to store the value, you want the value saved to a writable data source, or you want the value stored to an existing variable) —or if you want to modify advanced XPath settings—then select the appropriate element in table on the right and click Modify. Next, configure the options as needed, then click OK. Available options are described in Options for Each Extracted Element.
...
You can also manually chain the XML Data Bank tool to a tool within the Responder, Action, or test suite. To configure the XML Data Bank as a chained tool, complete the following:
...
:
...
(Not applicable for use with Message Responders)
Ensure that you have an action set or test suite with at least two tools.
Right-click the node for the tool associated with the data you want to extract
Conditional Content Product: (SOAVirt, Virtualize) Product: (SOAVirt, Virtualize) sv-attr:0A010204015A9054C88481D043445E2F 0A010204015CF6008A11EEF43AC91334 0A010204015A9054C88802B9600247DF (e.g., if you want to extract a value from an incoming request or outgoing response, choose the Message Responder that handles those messages)
, then choose Add Output.
In the Add Output wizard, indicate where you want to extract the value from (e.g., SOAP Envelope
Conditional Content Product: (SOAVirt, Virtualize) Product: (SOAVirt, Virtualize) sv-attr:0A010204015A9054C88481D043445E2F 0A010204015CF6008A11EEF43AC91334 0A010204015A9054C88802B9600247DF , Incoming Request, Transport Header, Incoming Attachment, Outgoing Response, etc.
) and click the Finish button. An XML Data Bank node displays below the tool.
- Configure the tool as follows:
Use the available controls to specify the XPaths that indicate what value you want to extract. To add an XPath, select a value from the Expected Message list and click the Extract Element button. The value you added displays in the Selected Element list with a Data Source Column name containing the name of the tool the value came from, as well as the extracted value.
Info title Working with the Expected Message The left panel displays the expected XML response used to create a template from which you can select elements. If this tool receives a valid XML message (e.g., from traffic or as defined by the client tool it is attached to), this panel will be populated automatically. Alternatively, you can copy a sample message into the Literal or Tree tabs. Note that the expected XML does not get saved by default; if you want to save it, enable the Save Expected XML option.If you want to further configure the XPath or customize extraction settings for this element, click Modify, then modify it as desired. See Options for Each Extracted Element for details.
- Repeat steps a and b as needed to configure any additional extractions you want performed.
- In the bottom area of the XML Data Bank configuration panel, customize the options as desired. See Tool-Wide Extraction Options for details.
...
Custom column name: Specifies the name of the data source column in which to store the value. Values are stored in an internal data source unless you specify otherwise (e.g., if you select Writable data source column or Variable). This is the name you will use to reference the value in other places. For example, if it is stored in a data source column named My Value, you would choose My Value as the parameterized value. You could also reference it as
${My Value}
in literal or multiple response views.Writable data source column: Enables storing the value in a writable data source column . This allows you to store an array of values. Other tools can then iterate over the stored values.
Write to all columns that match: Enables storing the value in all columns whose name contains the specified string. When extracting multiple values from a message, each value will be written across all the columns that match. In contrast, if you pick a single writable data source column (the above option), then the values will be written down the column across multiple rows.
Variable: Enables saving the value in the specified variable so that it can be reused across the current Responder, Action, or test suite. The variable must already be added to the current suite as described in
Conditional Content Product: (Virtualize) Product: (Virtualize) sv-attr:0A010204015A9054C88481D043445E2F 0A010204015A9054C88802B9600247DF Defining Variables in Virtualize.
Any values set in this manner will override any local variable values specified in the Responder, Action, or test suite properties panel.
...
For headers, you can configure the header name, as well as the data source column options listed above.
Anchor | ||||
---|---|---|---|---|
|
...