User GuideReference ManualIntegration Scenarios
 

2.2.2. Message Validation

See: Managing Channels - Message Edit Functions

In Babelway interface, it is possible to set up validations at message definition level.

You can set up validation rules for incoming and/or outgoing messages. These validations will be performed at runtime on messages.

To add validation rules, right click on a node in message definition window and select Add Validations... submenu. There are 3 basic validation rules that you can set up directly. In addition, you can also define your own rules in Xpath language.

  • Mandatory is used to check that the selected (value or structural) node is always present in the message.

  • Max Length defines a maximum length for the node value.

  • Min Length defines a minimum length for the node value.

  • Custom enables you to define your own Xpath validation rule.

Several validation rules may be applied to a same node. For example, using together a Max Length and a Min Length rule makes it easy to check that a node value has a specific length.

Once a validation rule has been added to a field, it will appears under the Validations section of message node. It can be removed by right-clicking on the validation rule and selecting the Delete command.

Example of Xpath validation rule:

string-length()>4
matches(.,"\d+") to validate if this field is only numeric 

Example of cross field validation rule:

For XML like this

<item>
<price>456</price>
<tax>123</tax>
</item>

You can write Cross field validation like

price > tax
  • If a validation rule is not met in a message, this message will not be further processed in the channel and an error will be raised.

  • If you are using XSD to define your incoming or outgoing message, all rules defined in XSD file will be validated at runtime even if you do not add specific validation rules at message level.

  • During xslt transformation, all data is seen as text string and therefore no specific validation is performed on data type at that stage.

  • Validation uses static values to identify the node to validate. If, after a mapping, a static value is overwritten, the validation my not be able to apply anymore, and may not validate all nodes.