Prowide ISO 20022

repository·main·Indexed 42 days ago

https://github.com/prowide/prowide-iso20022

A Java framework for parsing, building, and managing ISO 20022 MX messages. It provides a full Java model, XML/JSON conversion capabilities, and a Builder API for converting Java objects back into ISO 20022 XML. The framework is organized into core and category-specific modules (such as pacs, camt, xsys, and sese) to manage JAXB-generated classes.

Tokens
928
Snippets
3
Records
6
Agent score
4%

What's inside Prowide ISO 20022

  1. Overview of Prowide ISO 20022

    main

    Prowide ISO 20022 is an open source Java framework designed for managing ISO 20022 messages. It serves as a complement to the Prowide Core library.

    Key capabilities include:

    • Java model: Provides Java representations for ISO 20022 MX messages (e.g., pacs.008.001.02) across all message categories and types.
    • Parser: Converts ISO 20022 XML into Java objects.
    • Builder API: Converts Java objects back into ISO 20022 XML.
    • JSON Conversion: Supports conversion to and from JSON formats.
  2. Understand the Prowide ISO 20022 module structure

    main

    The project is organized into several subprojects to manage the large volume of JAXB-generated classes. You can choose to use the single uber jar (containing all categories like pacs, camt, xsys, sese, etc.) or select specific modules to reduce your dependency footprint.

    Core Modules

    • iso20022-core: Contains main common code, base classes, and the API for headers.
    • model-common-types: A common business types dictionary used by many message categories.

    Category-Specific Modules

    Each message category is split into two parts:

    • model-[category]-mx: The Document classes (the entry point for specific message types).
    • model-[category]-types: The business types dictionary specific to that category.

    Dependency Hierarchy

    • iso20022-core depends on model-common-types.
    • model-[category]-mx depends on iso20022-core, model-[category]-types, and model-common-types.
  3. Configure JAXB dependencies for Java 9+

    main

    The project requires javax.xml.bind at runtime. While this is included in the JDK up to Java 8, users running on Java 9 or higher must explicitly add these dependencies (or an equivalent implementation) to their application to ensure XML processing works correctly.

    implementation 'javax.xml.bind:jaxb-api:2.3.1'
    implementation 'com.sun.xml.bind:jaxb-impl:2.3.3'
  4. Build specific ISO 20022 modules using Gradle

    main

    If you do not want to use the uber jar and prefer to build individual jars for specific message categories (e.g., pacs and camt), you can run the following Gradle commands to generate the necessary artifacts in their respective module folders:

    ./gradlew :iso20022-core:jar
    ./gradlew :model-common-types:jar
    ./gradlew :model-pacs-mx:jar
    ./gradlew :model-pacs-types:jar
    ./gradlew :model-camt-mx:jar
    ./gradlew :model-camt-types:jar
  5. JSON serialization and deserialization of MX messages

    main

    The AbstractMXAdapter provides the mechanism for converting ISO 20022 (MX) messages to and from JSON using the Gson library.

    Serialization Behavior: When an MX message is serialized, the adapter performs the default object serialization and then injects two specific properties into the resulting JSON object:

    1. @xmlns: The namespace of the message, retrieved via mx.getNamespace().
    2. identifier: The unique message identifier, retrieved via mx.getMxId().id().

    Deserialization Behavior: To deserialize a JSON object into an MX message, the adapter requires a top-level JSON property named identifier. The adapter uses this identifier to dynamically determine the correct Java class to instantiate. It follows a naming convention where it looks for a class named com.prowidesoftware.swift.model.mx.Mx followed by the camelized version of the identifier.

    If the identifier property is missing or the corresponding class cannot be found, a JsonParseException is thrown.