Scrivio Interview library
DesignPrincipal6 min read · updated 12 November 2026

Your company must produce regulated XML reports (for example ISO 20022 payment messages) for many countries, with schema versions changing every year. How would you design the platform for producing and validating them?

I would map from one internal canonical payment model to each external format, so business logic never depends on a schema version. For every official XSD version I would generate binding classes or mappings and keep the versions side by side, select the version per country and date, and validate every outgoing message against the XSD and the business rules before sending, keeping validated copies for audit. Schema updates become a planned yearly release driven by the regulator's or network's test packs, and I would seriously consider buying a commercial message library for the rule sets that are expensive to maintain in-house.

Why this question is asked

ISO 20022 is the international standard for financial messages, such as pain.001 for customer credit transfers, pacs.008 for interbank payments and camt.053 for account statements. Payment networks and regulators publish their own versions and usage rules on top of it, and they change every year. A company that sends payments or regulatory reports to many countries must produce exactly the right XML for each one, and a rejected message can mean a missed payment deadline or a fine. Interviewers ask this at the most senior levels to see whether we can design for constant change and audit. In this answer, we will set out the requirements, design the canonical model and versioned mappers, build the validation pipeline, plan the yearly schema cycle, and weigh buying against building.

1What the Platform Must Handle

ISO 20022 messages are defined by XSDs with names that include a version, for example pacs.008.001.08, and a network or market infrastructure adds usage guidelines: which optional fields are mandatory, maximum lengths, allowed codes and cross-field rules that an XSD cannot express. Different countries and networks may require different versions at the same time, and each announces new versions with a fixed go-live date, typically once a year.

So the platform must produce several versions of the same message type simultaneously, switch versions on a date per destination, apply rules beyond the XSD, and prove afterwards exactly what was sent. Those four needs drive the design.

2A Canonical Model and Versioned Mappers

Business systems produce payments in our own canonical model: amounts, parties, accounts, purposes and references, with our own validation. They never see an ISO 20022 class. At the edge, a mapper per message type and version converts the canonical payment into the external format. For each official XSD version we generate binding classes with Jakarta XML Binding into a version-specific package, so pacs.008.001.08 and pacs.008.001.10 can live side by side in the same application.

Java
// generated per version, never edited by hand
// com.acme.iso.pacs008.v08.Document
// com.acme.iso.pacs008.v10.Document
public interface PaymentMessageMapper {
MessageVersion version(); // e.g. pacs.008.001.10
Object toDocument(CanonicalPayment p); // generated Document of that version
}
@Component
final class MapperRegistry {
private final Map<MessageVersion, PaymentMessageMapper> byVersion;
private final VersionCalendar calendar; // country/network -> version valid on a date
PaymentMessageMapper forDestination(Destination d, LocalDate date) {
return byVersion.get(calendar.versionFor(d, date)); // version switch is configuration
}
}
Step throughReport and message platform
  1. Business systemsproduce canonical payments
  2. Canonical modelour types, our validation
  3. Version calendar and mapper registrydestination and date decide the version
  4. Versioned mappersgenerated classes per XSD version
  5. Validation pipelineXSD, usage rules, business rules
  6. Delivery and audit storesend, keep validated copy and result

6 layers, from the top down. Step through them one at a time.

The calendar is the key piece. Moving a country from version 08 to version 10 on a go-live date is a configuration entry, deployed in advance and tested, not a code change on the night. If a network postpones a go-live, as happens, we change the date.

3Validating Every Message Before It Leaves

Every outgoing message passes three checks. The XSD check validates the generated XML against the exact official schema version with a Validator; the generated classes make most errors impossible, but not all, for example pattern facets or lengths. The usage rule check applies the network's guidelines that go beyond the XSD, such as mandatory fields for one market or code lists. The business rule check applies our own rules, such as amount limits or sanctions screening status. A message that fails any check is never sent; it goes to an exception queue with a readable reason.

Step throughLifecycle of one outgoing message
  1. Map canonical payment with the version for destination and dategenerated classes
  2. Marshal to XMLUTF-8, exact namespace of the version
  3. Valid against the official XSD?
    YesContinueNoException queue with the error
  4. Passes usage and business rules?
    YesContinueNoException queue with the rule
  5. Store validated copy with hash and versions usedimmutable audit store
  6. Send and record the acknowledgementlinked to the stored copy

6 steps in order. Play them, or step through them one at a time.

Keeping the validated copy, together with the schema version, rule set version and a hash, means that when a regulator or a counterparty asks what we sent on a given day, we can produce the exact bytes and show that they passed validation. The audit store should be immutable, for example object storage with retention locks, with retention periods that match the regulation.

4Schema Updates as a Planned Yearly Release

Because new versions arrive on a known cycle, we treat them as a planned release rather than a scramble. When the network publishes the new schemas and guidelines, typically months before go-live, we generate the new classes, write the new mapper (usually a copy of the previous one with the differences applied), add the version to the calendar with its date, and run the regulator's or network's official test packs and our own regression samples against it.

Many networks also offer a test environment and require certification messages before go-live; that goes into the plan. Old versions stay in the code until every destination has moved and the audit period for messages produced with them no longer needs re-generation, after which we remove them deliberately.

5Buy Versus Build

Generating classes from XSDs is easy. Maintaining the usage guidelines and cross-field rules for many networks and countries, every year, is not: it needs specialists who read the specifications, and mistakes are costly. Commercial ISO 20022 message libraries and validation products ship those rule sets, the generated models and updates for each yearly release.

So I would compare the licence cost against the engineering effort per year: how many message types, networks and countries, and how many people-weeks each yearly cycle costs us today. A common split is to build the canonical model, the calendar, the audit store and the workflow ourselves, because those are specific to our business, and to buy the message models and rule validation, plugging them in behind our mapper and validator interfaces so we can switch vendors later.

6Follow-up questions

Why not just store the XSD and write XML with templates?

Templates produce text without type checks, so a missing mandatory element or a wrong order is only found by validation at the end, and every version means editing templates by hand. Generated classes catch most structural errors at compile time and make the differences between versions visible in code review.

How do you test a new version before the go-live date?

We run the official test packs and our regression samples through the new mapper and validator in CI, compare the output of the old and new versions for the same canonical payments to review the differences, and send certification messages in the network's test environment. On the go-live date only the calendar switches.

What about incoming ISO 20022 messages?

The same structure works in reverse: validate against the version's XSD, unmarshal with that version's generated classes, and map into the canonical model, with parsers configured securely because the input comes from outside.

7Conclusion

In this answer, we designed a platform for regulated ISO 20022 messages around one canonical payment model, with mappers and generated binding classes per official XSD version kept side by side and a version calendar that chooses the version by destination and date. Every outgoing message is validated against the XSD, the usage guidelines and our business rules, and its validated copy is stored for audit. Schema updates are a planned yearly release driven by the official test packs, and a buy-versus-build comparison often favours commercial libraries for the rule sets.

What to say in the interviewAbout 90 seconds aloud

Open with

The core of my design is a canonical payment model owned by us. Business systems produce canonical payments and never see ISO 20022 classes, so a schema version change never touches business logic.

Then, if they want more

At the edge, for each official XSD version, say pacs.008 version 08 and version 10, I generate Jakarta XML Binding classes into separate packages so they live side by side, and I write a mapper per message type and version.

A version calendar says which version each country or network requires from which date, so a go-live is a configuration change prepared in advance. Every outgoing message is validated before it leaves: against the exact XSD, against the network's usage guidelines that go beyond the schema, and against our business rules.

Failures go to an exception queue with a readable reason, never to the network. Each validated message is stored immutably with its hash, schema version and rule versions, and linked to the acknowledgement, so we can show auditors exactly what we sent.

Since new versions come every year on a known schedule, I would run them as a planned release with the regulator's or network's test packs and certification in their test environment. Finally, I would seriously evaluate commercial ISO 20022 libraries, because maintaining usage rules for many networks is expensive, and plug them in behind our own interfaces.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your company must produce regulated XML reports (for example ISO 20022 payment messages)...": https://scrivio-interview-library.netlify.app/java/xml-processing/3a534062e8/