This topic covers the Form XML view, which
Sections include:
Introduction
You can specify how you want to enter messages from the Input Mode drop-down in message tools and responders (e.g., Request, Response, Payload). Form XML provides a tree view of XML messages and responses so that you can configure XML messages. The literal XML is represented graphically so that you can add, remove, and rename components of the XML message. You can also use If a data source is available, data source values can be used in configuring XML messages. Any changes made in the Form XML mode will also be made in the Literal XML mode and vice versa.
If Form XML is selected as the SOAP Envelope, the lower part of the panel consists of an XML View Tree and XML Configuration Tabs.
Populating the Form Input View from the Literal XML view
If you want a simple way to view and work with an existing XML message (e.g., a sample from developers, traced from the server, from legacy testing tools, etc.), you can copy it into the Literal XML view, then open the Form Input view. Once a message is copied into the Literal XML view, the Form Input view is populated in a schema-aware and schema-constrained manner that is much simpler to edit, manage, and parameterize.
XML Tree Options
Form XML displays the literal XML as a tree with each tree node representing an element.
Right-click on a node in the tree to access the XML tree view options.
Option | Description |
---|---|
Cut Copy Paste Delete | You can cut or copy a node to your OS clipboard or paste a node from your clipboard into the tree. When attempting to paste an element within the root element, a dialog will ask you whether to replace the entire content or add as a child. You can perform cut, copy, and paste operations across multiple XML View Trees within Diff tools, SOAP Clients, HTTP Traffics, and so on. These operations persist parameterization and any other exclude/encode settings. You can also delete a node from the tree. |
Insert New | Select to insert a new Element, Attribute, or Namespace Declaration. Depending on your selection, the corresponding tab will display parameter options. |
Encode Child Elements | Select to encode a subtree of elements as text content for its parent element. If this option is selected for a particular node, all child elements of that node will display as italicized in the Form XML tree and will be encoded as text within the parent element, rather than as XML. If this option is not selected, child elements will not be encoded and will remain as sub-elements. |
XML Encoding | Select an encoding option for escaped XML fragments. Options are:
This option only appears if the node contains no child nodes. |
Import Schema Element | Select to choose elements for both the body and the header. After selecting this option, a dialog appears from which you can load declared elements from a schema location. After loading elements, you can select multiple elements for the SOAP header. Once you click OK, a SOAP Envelope will be created based on the chosen element definitions. |
Expand All | Select to expand all nodes in the XML View Tree. |
Collapse All | Select to collapse all nodes in the XML View Tree. |
Move Up | Select to move a node up within the XML View Tree. This option only appears if the node is lower in the tree than a sibling element. |
Move Down | Select to move a node down within the XML View Tree. This option only appears if the node is higher in the tree than a sibling element. |
Populate | Fills SOAP array and element parameters. This also sets any element nils to false and expands them out. This command is only available if the tool is created from a WSDL. |
Show Namespaces | Select to view the namespaces within the XML View Tree. |
Show Attributes | Select to view the attributes within the XML View Tree. |
Beautify | Select to beautify all well-formed XML fragments. |
Compact | Select to reformat XML to fit on one line. |
XML Element Configuration Options
The XML Configuration Tabs (Elements, Attributes, Namespace Declarations) allow you to add, remove, and rename XML components. To add or modify an XML component, select the appropriate node from the XML View Tree, and then click on the appropriate XML configuration tab.
Element Tab
Displays options to modify Element parameters of the selected node from the XML View Tree.
To add a new Element, right-click the desired node from the XML View Tree and select Insert New> Element from the shortcut menu. A NewElement node will appear underneath the node you right clicked. Select the NewElement node to configure it.
The following options are available in the Element tab of the Form XML mode:
Option | Description |
---|---|
Use Data Source: Exclude with empty string | (Only available if a data source is specified in the related tool) Allows you to control whether elements and attributes are sent depending on the values in a data source. For more information, see Using Data Sources with Form XML: Excluding Elements and Attributes. |
Value | (Only available if the Element has no children elements within it) Specifies the content value of the Element. If a data source is available, you will have the option to choose either a Fixed or a Parameterized value from a drop-down menu. For more information, see Using Data Sources with Form XML: Parameterized Values. |
Prefix | Specifies the namespace prefix for the Element. Depending on the namespace declarations of the selected element and it’s ancestors, the options in the Prefix drop-down menu will vary. |
Local name | Specifies the local name for the Element. If a data source is available, you will have the option to choose either a Fixed or a Parameterized local name from a drop-down menu. For more information, see Using Data Sources with Form XML: Parameterized Values. |
Attributes Tab
Displays options to add and/or modify Attribute parameters of the selected node from the XML View Tree.
The following options are available in the Attributes tab of the Form XML mode:
Option | Description |
---|---|
Attributes | Displays a list of the current attributes of the selected node. |
Remove | Click to remove the selected attribute from the Attributes list. |
Add New Attribute | Click to add a new attribute to the Attributes list. |
Use Data Source: Exclude with empty string | (Only available if a data source is specified in the related tool) Allows you to control whether elements and attributes are sent depending on the values in a data source. For more information, see Using Data Sources with Form XML: Parameterized Values. |
Value | Specifies the content value of the Attribute. If a data source is available, you will have the option to choose either a Fixed or a Parameterized value from a drop-down menu. For more information, see Using Data Sources with Form XML: Parameterized Values. |
Prefix | Specifies the namespace prefix for the Attribute. Depending on the namespace declarations of the selected element and it’s ancestors, the options in the Prefix drop-down menu will vary. |
Local name | Specifies the local name for the Attribute. If a data source is available, you will have the option to choose either a Fixed or a Parameterized local name from a drop-down menu. For more information, see Using Data Sources with Form XML: Parameterized Values. |
Namespace Declarations Tab
Displays options to add and/or modify Namespace Declaration parameters of the selected node from the XML View Tree:
The following options are available in the Namespace Declarations tab of the Form XML mode:
Option | Description |
---|---|
Namespaces | Displays a list of the current namespace declarations of the selected node. |
Remove | Click to remove the namespace from the Namespaces list. |
Add New Namespace | Click to add a new namespace declaration to the Namespaces list |
URI | Specifies the URI of the namespace declaration. If a data source is available, you will have the option to choose either a Fixed or a Parameterized URI from a drop-down menu. For more information, see Using Data Sources with Form XML: Parameterized Values. |
Prefix | Specifies the prefix of the namespace declaration. If a data source is available, you will have the option to choose either a Fixed or a Parameterized Prefix from a drop-down menu. For more information, see Using Data Sources with Form XML: Parameterized Values. |
Using Data Sources with Form XML: Parameterized Values
If a data source is specified in the upper right corner of the tool, you will be able to use the values in that data source as parameterized values in the XML components of the Form XML mode. For example, you can use all the values in a data source column as a content value for an Element.
If a data source is specified in the tool, you will have a choice to select either a Fixed or a Parameterized value. If a data source is not available, then only a Fixed value can be entered.
- Fixed values are the literal values that you specify by entering an input into the available text field. When applicable, you can reference variables using the
${name_of_variable}
notation. - Parameterized values are the values from a data source column, or from the Data Source wizard (which allows you to parameterize the current tool with values from other tools). When configuring Parameterized values, a drop-down box containing column names from a data source will become available.
Using Values Stored in an Existing Data Source Column
The column names in the drop-down menu to the right of the Parameterized field correspond to the data source columns specified in the tool. All values in the data source column that you select will be sent as the literal value by the tool.
Using Values from Other Tools
To use a value from another tool, choose Use Data Source Wizard from the box that also displays column names. See XML Data Bank, for more details on completing this wizard.
Once a value is extracted, it will appear in the list of available columns.
Using Data Sources with Form XML: Excluding Elements and Attributes
You can create a data source that controls whether or not the tool includes or excludes particular elements and attributes as part of the message.
If the Use Data Source: Exclude with empty string check box is selected in either the Element or Attribute Form XML Configuration Tabs, the tool will use an empty string (a string of length 0) of the specified data source as a condition that controls whether or not to include or exclude elements and attributes as part of the message. For example, you can create a data source that contains values for users’ names and passwords. By entering empty strings that correspond to the password values, you can exclude these password values from the message.
To exclude an element or attribute from a message:
Create a data source with columns that contain the values you would like to send as part of a message, and columns that contain the empty and non-empty strings that signify the inclusion or exclusion of an element.
In the following data source example, the Value column contains values of name and password, and the Exclude Password column has a value of Don’t Exclude, as well as an empty string.
For more information on configuring data sources, see Parameterizing Tests with Data Sources, Variables, or Values from Other Tests.- Ensure that the correct data source is selected from the Data Source menu in the tool panel.
- Check the Use Data Source: Exclude with empty string check box in either the Element or Attribute Form XML Configuration Tab.
- In the drop-down box next to the Use Data Source: Exclude with empty string check box, select the appropriate column that contains the empty string.
- In the Value drop-down boxes, specify the content value of the Element/Attribute by selecting Parameterized and the appropriate column that contains the data source values to be sent as part of the message.
When the tool is run, the password value from the data source will not be sent as part of the message because it was excluded by the empty string in the Exclude Password column that was chosen from the Use Data Source: Exclude with empty string drop-down box.
To send all of the parameterized values from a data source, do not select the Use Data Source: Exclude with empty string check box.