Validate XML

The Validate XML task is used to validate message data, a WSDL message, XML text, binary, or XML tree formats against a schema.

The output of the Validate XML task is contributed to the mediation exchange, and can be used by downstream tasks. Validate XML processes an XML document against an XML schema, to report any errors found. It does not produce a parsed tree.

You choose the schema against which validation is to be performed by first specifying its reference type in the General tab of the Validate XML task:
  • A static reference enables you to select a single (static) schema from a folder that is in your project.
  • A dynamic reference enables you to select a set of schemas from a folder that is in your project. At run-time one of the schemas in the list will be used dynamically for validation, based on the input to the mediation task. When you specify a folder for dynamic reference, ActiveMatrix recursively includes the schemas under this folder and its sub-folders
Note: The schema for a reference must be located in the same project as the mediation flow that uses it.

General Tab

On the General tab you specify a name and description for the task, and specify the type of schema to be used during verification.

Field Description
Name Assign a name to the task, to identify the task in the mediation flow. This name appears in the tooltip that opens when you hover the cursor over the task icon in the mediation flow.
Description Describe the task briefly. This description appears in the tooltip that opens when you hover the cursor over the task icon in the mediation flow.
Throw Fault on Validation Error

When this option is set, an error in the Validate XML task results in a MediationTaskFault.

When this check box is not selected, an error in the Validate XML task produces output that contains two fields:

valid has two values: true if the XML is valid; false if the XML is invalid.

error appears if the XML validation fails, and contains an errorCode and an errorMessage. These codes follow the W3C specification for XML schema.

Input Select the input type:
  • MessageData—Validates the mediation or target operation’s input data. This option reads the input message itself, so no mapping is required. MessageData is the default input type.
  • WSDL Message—Validates the input or output of any operation in the WSDL. When you select the WSDL Message option, the Schema Source field opens. Select the mediation or target option, and the message type (input or output).
  • Text
  • Binary
  • XML Tree
Schema Reference Type When you select an input type of Text, Binary, or XML Tree, you can choose a static or dynamic reference type:
  • A static reference enables you to select a single (static) schema from a folder that is in your project.
  • A dynamic reference enables you to select a set of schemas from a folder that is in your project. At run-time one of the schemas in the list will be used dynamically for validation, based on the input to the mediation task. When you specify a folder for dynamic reference, ActiveMatrix recursively includes the schemas under this folder and its sub-folders.
Schema Element or Schema Folder This field is based on whether you choose a static or dynamic reference type:
  • If you choose Static Reference Type, the Schema Element field appears. Specify the XML schema document against which the incoming XML will be validated.
  • If you choose Dynamic Reference Type, the Schema Folder field appears. Specify the folder where schema resources are located.

Input Tab

The content of the Input tab depends on the Input type you selected on the General tab.

Field Description
MessageData No mapping is required in the Input tab.
WSDL Message Displays a message tree corresponding to the operation and message selected in the General tab.
Text

Specify the xmlString input to validate.

If you chose a Dynamic Reference Type in the General tab, you can specify an optional elementName.

Binary

Specify the xmlBinary input to validate.

If you chose a Dynamic Reference Type in the General tab, you can specify an optional elementName.

Tree

In the xmlTree node, specify any element to validate.

If you chose a Dynamic Reference Type in the General tab, you can specify an optional elementName.

Output Tab

The Output tab of the Validate XML task shows the results of the validation, indicating whether the incoming XML is valid or invalid, after being verified against the specified schema.

If validation fails, an error description identifies the cause of the failure. You can log this error description for design-time troubleshooting.

If the Throw Fault field is selected, no output is produced by this task. The Output tab shows a tree with the message No Output Configured.