JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Java CAPS SWIFT Message Library User's Guide     Java CAPS Documentation
search filter icon
search icon

Document Information

SWIFT Message Library

Overview of SWIFT Message Libraries

Library Versions and Access

Installing the SWIFT Message Library

Increasing the Heap Size

To Increase the Heap Size for GlassFish

To Increase the Heap Size for NetBeans

Using the SWIFT Message Library

SWIFT Message Type OTDs

SWIFT Message Structure

Message Library and Collaboration Locations in NetBeans

SWIFT Message Type Reference

Category 1 Messages

Category 2 Messages

Category 3 Messages

Category 4 Messages

Category 5 Messages

Category 6 Messages

Category 7 Messages

Category 8 Messages

Category 9 Messages

Validation Collaborations

SWIFT Generic Library

SWIFT Message Library JAR Files

Using Message Validation Features

Basic Validation Features

Validation Components

Validation Methods

Validation Collaboration Definitions

Validation Operation

Basic validation steps

Library Methods

Message Validation Rules

Message Format Validation Rules (MFVR)

MFVR Validation Methods

MFVR Errors

In Collaboration Validation Methods

validate()

Description

Syntax

Parameters

Return Values

Throws

validateMFVR()

Description

Syntax

Parameters

Return Values

Throws

validateMPR()

Description

Syntax

Parameters

Return Values

Throws

Calling the Validation Methods in your Collaboration

SWIFT Projects

Importing a Sample Project

To Import a Sample Project

SWIFT Projects and NetBeans

About the SWIFT MX Validation Sample

Sample Project

Descriptions of components

Running the MX Sample Project

SWIFT Correlation Repository Sample

Prerequisites

Installation steps

Preparing an SCR flow

Designing an SCR flow

Linking the Domain Name and Direction to a Color

Using the SCR for Monitoring Flows

Using the Viewer for Monitoring Transactions

Using the SCR as Gatekeeper

Using the Viewer to Repair Messages

Updating BICDirService

Source of Information

Update Operation

BICDirService Method Operation

Lookup Method Definitions

Validation Method Definitions

BICDir Exceptions

Error message framework

Error Message General Form

Updating BICPlusIBAN

To Update BICPlusBAN Information

BICPlusIBAN Validation Method Definitions

Error Message Information

Error Messages

Setting the Debug Level

Message Examples

Parse Debug Level Message Example

Using SWIFT FIN-Based Funds OTDs

SWIFT Message Library Funds Features

Using SWIFT Message Library Java Classes

Relation to OTD Message Types

SWIFT Message Library Javadoc

OTD Library Java Classes

In Collaboration Validation Methods

As an alternative to using the Validation Collaborations, the SWIFT Message Library offers validation methods, validate(), validateMPR(), and validateMFVR(), that can be invoked by a Collaboration to validate SWIFT OTDs directly in the Collaboration. For example, if you have an OTD for message MT 541, you can call the OTD’s validateMFVR() method from the Collaboration, and the Collaboration validates the message’s MFVRs.

The validation methods are available for the same SWIFT message OTDs listed under Message Validation Rules. You can see (or select) these validation methods by right-clicking the SWIFT message OTD from the Collaboration Editor’s Business Rules Designer and clicking Select method to call on the shortcut menu.

validate()

Description

This method validates applicable MFVR rules against the OTD instance, and throws a MessageValidationException if the OTD is invalid in regard to applicable MFVR rules. Call MessageValidationException.getErrorMessage() to obtain the error message details.

If the OTD does not have applicable MFVR rules, the method call returns without throwing a MessageValidationException.

Syntax
public void validate()
Parameters

None.

Return Values

None.

Throws

com.stc.swift.validation.MessageValidationException: Thrown when the OTD is invalid in regard to applicable MFVR rules.

validateMFVR()

Description

This method validates the applicable MFVR rules against the OTD instance, and throws a MFVRException if the OTD is invalid in regard to applicable MFVR rules. Call MFVRException.getErrorMessage() to obtain the error message details.

If the OTD does not have applicable MFVR rules the method call always returns without throwing an MFVRException.

Syntax
public void validateMFVR()
Parameters
None.
Return Values

None.

Throws

com.stc.swift.validation.MFVRException: Thrown when the OTD is invalid in regard to applicable MFVR rules.

validateMPR()

Description

This method validates the applicable MPR rules against the OTD instance, and throws a MPRException if the OTD is invalid in regard to applicable MPR rules. Call MPRException.getErrorMessage() to obtain the error message details.

If the OTD does not have applicable MPR rules the method call always returns without throwing an MPRException.

Syntax
public void validateMPR()
Parameters
None.
Return Values

None.

Throws

com.stc.swift.validation.MPRException: Thrown when the OTD is invalid in regard to applicable MPR rules.

Calling the Validation Methods in your Collaboration

The validation methods are available at the OTD level, and can be called after the OTD is populated with its values. This usually occurs after a message is unmarshaled in the OTD. The following fragment of code demonstrates the use of the validate method within a Collaboration. In this example, validate() is called and either “message OK” or the exception error String is written to the log.

import com.stc.swift.validation.MFVRException;
import com.stc.swift.validation.SVRException;
import com.stc.swift.validation.ValidatingSWIFTMTOTD;
import com.stc.swift.validation.bic.BICDir;
import com.stc.swift.validation.BICPlusIBAN.*;
import com.stc.swift.validation.MessageValidationException;
import com.stc.swift.otd.v2010.std.mt_541.Mt_541;
import java.util.*;


public class ValidateMt_541_Modified
{

    public boolean receive( com.stc.connectors.jms.Message input, 
xsd.ValidationReplyMessage.Result output, com.stc.connectors.jms.JMS
 invalidMessages, com.stc.connectors.jms.JMS validMessages,
 com.stc.swift.otd.v2010.std.mt_541.Mt_541 mt_541_1 )
        throws Throwable
    {
        com.stc.connectors.jms.Message result = validMessages.createMessage();
        result.setTextMessage( input.getTextMessage() );
        String errors = null;
        String msg = "";
        try {
            mt_541_1.unmarshal( (com.stc.otd.runtime.OtdInputStream)
 new com.stc.otd.runtime.provider.SimpleOtdInputStreamImpl(
 new java.io.ByteArrayInputStream( input.getTextMessage().getBytes() ) ) );
        } catch ( Exception ex ) {
            errors = ex.getMessage();
            errors += "\r\n";
            errors += "Last successful parse: " + mt_541_1.getLastSuccessInfo();
            result.storeUserProperty( "ValidationErrors", errors );
            invalidMessages.send( result );
            output.setErrorMessages( errors );
            output.setIsError( true );
            output.setSwiftMessage( input.getTextMessage() );
            return false;
        }
        logger.info( "Unmarshalled MT541 message." );
        logger.info( "MFVR validation to follow ....." );
        // Call Default Validation logic for validation against applicable MFVRs
        try {
            mt_541_1.validate();
        } catch ( MessageValidationException mve ) {
            errors = mve.getErrorMessage();
            msg = mve.getMessage();
        }
        logger.info( "Completed MFVR validation" );
        logger.info( "BICPlusIBAN validation to follow ....." );
        if (errors == null) {
            logger.info( "No MFVR Exception" );
        } else {
            logger.info( "Found MFVR Exception" );
            logger.info( "Errors: " + errors );
            logger.info( "msg: " + msg );
        }
        // End of "Default Validation" invoking
        //
        // Call BICPlusIBAN validation
        String BICPlusIBANresult = "";
        String bicCode = mt_541_1.getBasicHeader().getLTAddress().substring( 0, 8 );
        String ibanCode = "DE615088005034573201";
        BICPlusIBANDir.setBIC_Code( bicCode );
        BICPlusIBANDir.setIBAN_Code( ibanCode );
        BICPlusIBANresult = "\n\n\n*** Validating BICPlusIBAN ***\n";
        BICPlusIBANresult = BICPlusIBANresult + 
"    BIC - " + BICPlusIBANDir.getBIC_code() + "\n";
        BICPlusIBANresult = BICPlusIBANresult + 
"    IBAN - " + BICPlusIBANDir.getIBAN_code() + "\n";
        BICPlusIBANresult = BICPlusIBANresult + 
"\n   a) Deriving the BIC from the IBAN...\n";
        ArrayList bicList = BICPlusIBANDir.deriveBICfromIBAN();
        if (bicList == null) {
            BICPlusIBANresult = BICPlusIBANresult + 
"      ==> Unable to derive BIC data from given IBAN.\n";
            if (errors != null) {
                errors = errors + "\n\nUnable to derive BIC data from given IBAN.\n";
            } else {
                errors = errors + "\n\nUnable to derive BIC data from given IBAN.\n";
            }
        } else {
            BICPlusIBANresult = BICPlusIBANresult + 
"      ==> BIC CODE and BRANCH CODE = " + (String) bicList.get( 0 ) + ".\n";
            BICPlusIBANresult = BICPlusIBANresult + 
"      ==> IBAN BIC CODE and BRANCH CODE = " + (String) bicList.get( 1 ) + ".\n";
            BICPlusIBANresult = BICPlusIBANresult + 
"      ==> ROUTING BIC CODE and BRANCH CODE = " + (String) bicList.get( 2 ) + ".\n";
        }
        BICPlusIBANresult = BICPlusIBANresult + "\n   b) Validating the Bank ID...\n";
        if (BICPlusIBANDir.validateBankID()) {
            BICPlusIBANresult = BICPlusIBANresult + 
"      ==> Valid Bank ID found in BI file.\n";
        } else {
            BICPlusIBANresult = BICPlusIBANresult + 
"      ==> No valid Bank ID found in BI file.\n";
            if (errors != null) {
                errors = errors + "No valid Bank ID found in BI file.\n";
            } else {
                errors = errors + "No valid Bank ID found in BI file.\n";
            }
        }
        BICPlusIBANresult = BICPlusIBANresult + "\n   c) Validating the BIC...\n";
        if (BICPlusIBANDir.validateBIC()) {
            BICPlusIBANresult = BICPlusIBANresult + 
"      ==> Valid BIC data found in BI file.\n";
        } else {
            BICPlusIBANresult = BICPlusIBANresult + 
"      ==> No valid BIC data found in BI file.\n";
            if (errors != null) {
                errors = errors + "No valid BIC data found in BI file.\n";
            } else {
                errors = errors + "No valid BIC data found in BI file.\n";
            }
        }
        BICPlusIBANresult = BICPlusIBANresult + 
"\n   d) Validating the BIC/IBAN Combination...\n";
        if (BICPlusIBANDir.validateBICIBANCombo()) {
            BICPlusIBANresult = BICPlusIBANresult + 
"      ==> BIC and IBAN codes are belong to the same institution.\n\n\n";
        } else {
            BICPlusIBANresult = BICPlusIBANresult + 
"      ==> BIC and IBAN codes are NOT belong to the same institution.\n\n\n";
            if (errors != null) {
                errors = errors + "BIC and IBAN codes are NOT belong
 to the same institution.\n\n\n";
            } else {
                errors = errors + "BIC and IBAN codes are NOT belong
 to the same institution.\n\n\n";
            }
        }
        logger.info( BICPlusIBANresult );
        //
        if (errors != null) {
            // errors = errors + BICPlusIBANresult;
            result.storeUserProperty( "ValidationErrors", errors );
            invalidMessages.send( result );
            output.setErrorMessages( errors );
            output.setIsError( true );
            output.setSwiftMessage( input.getTextMessage() );
            return false;
        }
        // passed validation
        String currMsg = result.getTextMessage();
        currMsg = currMsg + BICPlusIBANresult;
        result.setTextMessage( currMsg );
        validMessages.send( result );
        output.setErrorMessages( "" );
        output.setIsError( false );
        output.setSwiftMessage( input.getTextMessage() );
        return true;
    }

To select a validation method from the Collaboration Editor’s Business Rules Designer, right-click the SWIFT message OTD and click Select method to call from the shortcut menu.