Validating a response in XML format is almost identical to the standard procedure. For more information about validating an HTTP request, see Global validation.
You may define validations on the XML response using XPath. To recap, XPath is a syntax that points to a portion of an XML document.
For an XML request, response validators may be created:
For the entire response: these are standard validators that validate the response content.
For a particular XML node: these are validators that are specific to the XML modules. An XML node can then be specified by selecting it in the dialog box that is displayed by clicking on the magnifying glass next to the field.
This will create an XPath expression based on the selected XML node. You may edit the expression manually, but you must make sure the XPath expression remains valid. The XPath expression may be variabilized.
You will then return to the normal procedure, except that instead of carrying out the validation on the entire server response, it will be done only on the part specified by the XPath expression.
To create a response validator using XPath
Create a validator.
Select the On a particular node by option and choose XPath in the list box.
Click on the magnifying glass next to the text field below and select the XML node to be validated.
Click OK. The XPath expression for the selected node is displayed in the text field.
Select the text to be validated by clicking on the magnifying glass next to the text field below.
Warning: Response validations on XML nodes are resource-consuming operations. Only use this type of validation if absolutely necessary.