Documentation for a newer release is available.
View Latest
Esta página no está disponible actualmente en Español. Si lo necesita, póngase en contacto con el servicio de asistencia de Icon (correo electrónico)
Validating an Example Message
The process of validating of a message is described in detail as part of Validation. It is strongly recommended to read that page to understand the difference between validation levels.
However, in summary to validate a Message Definition instance in the strictest way possible(Schema Rules, Message Rules and Business Rules) you can use the MessageComponentValidator as follows:
// Get JsonMapper instance
JsonMapper jsonMapper = ISO20022MessageModel.getInstance().jsonMapper();
// De-serialising from Json
FIToFICustomerCreditTransferV08 cct = jsonMapper.fromJson(json, FIToFICustomerCreditTransferV08.class);
// Get validator instance
MessageComponentValidator validator = ISO20022MessageModel.getInstance().validator();
//validate
ValidationResult<CustomerCreditTransferInitiationV09> result = validator.validate(ccti, ValidationOptions.ruleValid());
boolean isValid = result.isValid() // true
The ValidationResult contains information around any violations, failures, or unimplemented rules, all of this is summarized within the isValid() method.