The XMLVerification allows users to validate content present in the message body or application context or both, against configured XSD(s) or DTD(s). The component has two output ports OUT_PORT and FAILED_PORT. If the validation is successful, then the message "without any changes" is sent to OUT_PORT, else the message is sent to FAILED_PORT with two additional properties ERROR_MESSAGE and STACKTRACE containing the error message indicating the problem and the source of the problem.
Content present in the message body or application context or both is considered valid only if
- the content has to be validated and is an XML instance.
- the structure of XML instance is valid according to corresponding XSD/DTD configured.
- the qualified root element of XML instance matches the configured qualified root element.
Configuration
The configuration for XML Verification is defined in the XMLVerification Configuration Property Sheet (CPS) as shown in the figure below.
Component Configuration
Figure 1: Configuration of XML Verification
Attributes
Error Handling Configuration
The remedial actions to be taken when a particular error occurs can be configured here. Click on the ellipses button against this property to configure Error Handling properties for different types of Errors. By default, the options Log to Error Logs and Send to error port are enabled.
Please refer the Error Handling section in Common Configurations page for documentation.
Figure 2: Error Handling Configuration
Source(s) of content to validate
This property determines the source(s) of content that should be validated
- Body - Only content of the message body has to be validated with XSD/DTD defined against property Body. When this option is selected, the property "Body" is visible and property Context is hidden.
- Context - Only content of application context has to be validated with XSD/DTD defined against property Context. When this option is selected, property "Context" is visible and property Body is hidden.
- Context-Body - Contents of both message body and application context have to be validated with XSD/DTD defined against properties Body and Context respectively. When this option is selected, both properties Context and Body are visible.
Structure for Message Body
This property defines the XSD/DTD with which content of the message body has to be validated. Click the ellipses button to open the editor to provide XSD/DTD.
Click the Load button to browse and add the XSD Schema file and select the root element to configure the schema.
Figure 3: Defining XSD / DTD
Expert Properties
Enable the Show Expert Properties checkbox to make the properties visible.
Figure 4: XMLVerification CPS with Expert Properties enabled and highlighted
Pre Processing XSL Configuration
Pre Processing XSL configuration can be used to transform request message before processing it. Click the ellipses button against the property to configure the properties.
Refer to the Pre/Post Processing XSL Configuration section under the Common Configurations page for details regarding Pre Processing XSL configuration and Post Processing XSL configuration (below).
Post Processing XSL Configuration
Post Processing XSL configuration can be used to transform the response message before sending it to the output port.
Process Message Based on Property
The property helps components to skip certain messages from processing.
Refer to the Process Message Based On a Property section under the Common Configurations page.
Threadpool Configuration
This property is used when there is a need to process messages in parallel within the component, still maintaining the sequence from the external perspective.
- This needs to be used only in such circumstances.
- If sequential processing is not required, please use sessions on the input port.
Click the Threadpool Configuration ellipses button to configure the Threadpool Configuration properties.
Figure 5: Threadpool Configuration properties
Enable Thread Pool
Enable this option to configure the properties that appear as below.
Pool Size
The number of requests to be processed in parallel within the component. Default value is '1'.
Batch Eviction Interval (in ms)
Time in milliseconds after which the threads are evicted in case of inactivity. New threads are created in place of evicted threads when new requests are received. Default value is '1000'.
Functional Demonstration
Scenario
Validate the input XML based on the schema provided.
Configure the XMLVerification component as described in the Configuration section for XSD Structure Body and use feeder and display components to send sample input and to check the response respectively. If the Sample Input verification is successful, then the input message is sent to Display_Out and if the verification fails, the input message is sent to Display_False.
Figure 6: Demonstrating scenario with sample input and sample output
Useful Tips
When the XSD defines multiple imported schemas containing same target namespace, only the first schema is used for validation and any elements defined in other schema are identified by the component.