Skip Navigation Links | |
Exit Print View | |
![]() |
Oracle Java CAPS SWIFT Message Library User's Guide Java CAPS Documentation |
Overview of SWIFT Message Libraries
Installing the SWIFT Message Library
To Increase the Heap Size for GlassFish
To Increase the Heap Size for NetBeans
Using the SWIFT Message Library
Message Library and Collaboration Locations in NetBeans
SWIFT Message Library JAR Files
Using Message Validation Features
Validation Collaboration Definitions
Message Format Validation Rules (MFVR)
About the SWIFT MX Validation Sample
SWIFT Correlation Repository Sample
Linking the Domain Name and Direction to a Color
Using the SCR for Monitoring Flows
Using the Viewer for Monitoring Transactions
Using the Viewer to Repair Messages
BICDirService Method Operation
To Update BICPlusBAN Information
BICPlusIBAN Validation Method Definitions
Parse Debug Level Message Example
Using SWIFT FIN-Based Funds OTDs
SWIFT Message Library Funds Features
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.
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.
public void validate()
None.
None.
com.stc.swift.validation.MessageValidationException: Thrown when the OTD is invalid in regard to applicable MFVR rules.
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.
public void validateMFVR()
None.
None.
com.stc.swift.validation.MFVRException: Thrown when the OTD is invalid in regard to applicable MFVR rules.
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.
public void validateMPR()
None.
None.
com.stc.swift.validation.MPRException: Thrown when the OTD is invalid in regard to applicable MPR rules.
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.