Oracle® Java CAPS SWIFT Message Library User's Guide: Part No: 821-2582 December 2011
Oracle® Java CAPS SWIFT Message Library User's Guide: Part No: 821-2582 December 2011
User's Guide
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual
property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software,
unless required by law for interoperability, is prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is
applicable:
U.S. GOVERNMENT RIGHTS. Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are
"commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental
regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable
Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial
Computer Software License (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently
dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall
be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any
liability for any damages caused by use of this software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered
trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro
Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and
its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation
and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.
120126@25097
Contents
3
Contents
4 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Message Library
This document provides information on installing the SWIFT message library as well as
instructions on using the library message validation features and some associated sample
projects. The following sections provide installation, library, and validation information for
SWIFT messages:
■ “Overview of SWIFT Message Libraries” on page 5
■ “Installing the SWIFT Message Library” on page 6
■ “Using the SWIFT Message Library” on page 7
■ “Using Message Validation Features” on page 24
■ “SWIFT Projects” on page 34
■ “Using SWIFT FIN-Based Funds OTDs” on page 49
■ “Using SWIFT Message Library Java Classes” on page 50
Each SWIFT message library represents a corresponding SWIFT message type. You can use
these libraries to transfer SWIFT message data with the Oracle Java CAPS.
5
Installing the SWIFT Message Library
are released corresponding to each revised set of SWIFT message types. Java CAPS supports the
message types for the current and previous year, so Java CAPS 6.3 supports the 2009 and 2010
libraries.
You must install each year’s version via a separate SAR file.
The annual SWIFT Message Libraries rely on the following components. The Adapters are
installed in the standard Java CAPS installation, and you can install the SWIFT Message Library
when you install the annual libraries.
■ File Adapter (the File Adapter is used by most sample Projects)
■ Batch Adapter (the Batch Adapter is required to run the MX validation sample project)
■ SWIFT Message Library (this includes all versions of the library)
When you install the SWIFT libraries, install SwiftOTDLibrary.sar and one or both of the
following files, depending on which versions of SWIFT messages you are using:
■ SwiftOTDLibrary2010.sar
■ SwiftOTDLibrary2009.sar
If you receive this message while building or deploying a SWIFT Project, increase the heap size
and then retry the process. If you receive the message during runtime, increase the GlassFish
server heap size. NetBeans automatically determines the heap size based on available memory,
but if you receive the message in NetBeans, increase the heap size for NetBeans as well.
1 In the GlassFish Admin Console, click Application Server in the left navigation panel.
2 Click the JVM Setting tab, and then the JVM Options subtab.
6 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Message Type OTDs
Note – Your Xmx option might have a default value other than 512 depending on your available
memory.
Each field component in the text block is preceded by a field tag. There are no field tags in the
header and trailer blocks. The one exception to this format is MT 121, EDIFACT FINPAY,
which has a single text field with no field tag identifier.
Information about a field common to all message types in which that field is used is found in the
Standards - General Field Definitions volume of the SWIFT User Handbook. Information about
a field specific to its use with a particular message type is found in the field specifications section
of the Standards volume of the SWIFT User Handbook for that message type.
The Validation Collaborations folder contains the Collaboration Definitions that enable the
validation features of the SWIFT Message Library. See “SWIFT Message Library JAR Files” on
page 23 for details. The Category 5 folder contains the SWIFT MT Funds message template
OTDs. See “Parse Debug Level Message Example” on page 48 for details.
The bic.jar file allows you to update the BICDirService feature. See “SWIFT Message Library
JAR Files” on page 23 for details.
8 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Message Type Reference
Securities Markets
■ See “Category 5 Messages” on page 14.
Travellers Cheques
■ See “Category 8 Messages” on page 19.
The remainder of this section discusses these categories and the message types within each
category. The 2009 and 2010 versions of the SWIFT Message Library are provided with the
SWIFT Message Library. You must install each version from a separate SAR file. The tables in
the following sections list each supported message type, though some are only supported in
version 2009 or version 2010, but not both.
For explanations of the different versions, see the SWIFT Web site at http://www.swift.com.
Category 1 Messages
The table below lists the Category 1 message types, Customer Payments and Cheques, with the
type designation MT 1xx.
MT 104 Direct Debit and Request for Debit Transfer Message (STP)
MT 195 Queries
MT 196 Answers
Category 2 Messages
The table below lists the Category 2 message types, Financial Institution Transfers, with the type
designation MT 2xx.
10 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Message Type Reference
MT 295 Queries
MT 296 Answers
Category 3 Messages
The table below lists the Category 3 message types, Treasury Markets, Foreign Exchange,
Money Markets, and Derivatives, with the type designation MT 3xx.
SWIFT Message
Type Description
TABLE 3 Treasury Markets, Foreign Exchange, Money Markets, and Derivatives (Continued)
SWIFT Message
Type Description
MT 395 Queries
MT 396 Answers
12 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Message Type Reference
Category 4 Messages
The table below lists the Category 4 message types, Collections and Cash Letters, with the type
designation MT 4xx.
MT 410 Acknowledgment
MT 420 Tracer
MT 495 Queries
MT 496 Answers
Category 5 Messages
The table below lists the Category 5 message types, Securities Markets, with the type designation
MT 5xx.
14 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Message Type Reference
MT 595 Queries
MT 596 Answers
16 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Message Type Reference
Category 6 Messages
The table below lists the Category 6 message types, Treasury Markets, Precious Metals, with the
type designation MT 6xx.
SWIFT Message
Type Description
MT 695 Queries
MT 696 Answers
Category 7 Messages
The table below lists the Category 7 message types, Treasury Markets, Syndication, with the
type designation MT 7xx.
MT 730 Acknowledgment
MT 760 Guarantee
18 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Message Type Reference
MT 795 Queries
MT 796 Answers
Category 8 Messages
The table below lists the Category 8 message types, Travellers Cheques, with the type
designation MT 8xx.
SWIFT Message
Type Description
MT 895 Queries
MT 896 Answers
Category 9 Messages
The table below lists the Category 9 message types, Cash Management and Customer Status,
with the type designation MT 9xx.
20 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Message Type Reference
MT 995 Queries
MT 996 Answers
Validation Collaborations
The table below lists the Validation Collaboration. Validation Collaboration Definitions are
provided for many key SWIFT message types.
22 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Message Type Reference
For information about the Validation Collaborations, see “Using Message Validation Features”
on page 24.
Validation Components
In addition to components described under “Basic Validation Features” on page 24, the SWIFT
Message Library also contains the following basic components:
24 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
Using Message Validation Features
■ SWIFT OTDs (2009 and 2010): OTDs in the SWIFT Message Library that represent
standard SWIFT message types.
■ MT Funds OTDs: Specialized OTDs that allow you to automate the specialized funds
operations. This category contains FIN-based OTDs.
■ Validation Collaboration Definitions: Components that define the validation logic and
that are provided for specific SWIFT message types. See “Validation Collaboration
Definitions” on page 25 for details.
■ Sample Projects: Sample Projects are provided as examples of validation implementation.
See “SWIFT Projects” on page 34 for details.
Validation Methods
The SWIFT Message Library provides three OTD API methods, validate(), validateMPR(),
and validateMFVR(), that can be invoked by a Collaboration to validate SWIFT OTDs directly
in the Collaboration (see “In Collaboration Validation Methods” on page 29). This is an
alternative to using the Validation Collaboration Definitions.
Messages are verified by parsing the data into a structure that conforms to the SWIFT standard
specifications. The validation functions use the Validation Collaborations to access specific data
that is then verified according the algorithms of the Message Format Validation Rules (MFVR)
specifications.
For lists of these Collaboration Definitions, see “Message Validation Rules” on page 27.
Validation Operation
You can combine the library’s validation features in any way to meet your business
requirements. The SWIFT Message Library packages a prebuilt implementation that takes
SWIFT messages from a JMS Queue or Topic and validates them individually, then writes the
results to a specified JMS Queue or Topic. One set contains valid messages, and the other
contains the invalid ones, along with messages indicating the errors generated.
■ If the message fails, the message and its parser error are sent to an error Queue. If the
message is valid, all applicable MFVR functions are applied to the message.
■ Any and all errors produced from these tests are accumulated, and the combined errors, as
well as the message, are written to an error Queue for later processing. As long as no error is
fatal, all applicable tests are applied.
■ Again any and all errors produced from these tests are accumulated, and the combined
errors and message are written to the error Queue for later processing.
■ If no errors are found in a message, it is sent to a Queue for valid messages.
For an explanation of using these Collaboration Definitions and the validation Project
examples, see “SWIFT Projects” on page 34.
Library Methods
The SWIFT Message Library provides a set of runtime methods that allow you to manipulate
OTD data in a variety of ways. The following methods are the most frequently used with
validation operations:
■ set(): Allows you to set data on a parent node using a byte array or a string as a parameter.
■ value(): Lets you get the string value of data in a node at any tree level.
■ getLastSuccessInfo(): Returns a string that represents information about the last node in
the tree that was successfully parsed.
■ command(): Allows you to pass flags as parameters, which set levels that determine the
quantity of debug information you receive (see “Setting the Debug Level” on page 46 for
details).
■ marshalToString() and unmarshalFromString(): Returns string data from or accepts
string data to a desired node.
In addition, the library has methods that allow you to perform basic but necessary operations
with the OTDs. See Table 11.
Method Description
26 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
Message Validation Rules
size() Returns the current number of repetitions for the current child node.
To help in your use of the SWIFT Message Library and its features, the library includes a
Javadoc. You can see this document for complete details on all of these methods. See Table 12
for more information on this document and how to use it.
There is one validation method for each MFVR message type and its corresponding OTD. Each
method is called on a particular OTD and is used to validate the data of a given instance of that
message type. Because business practices vary greatly between organizations, these functions
can be modified as needed.
For examples of how the MFVR validation process works, you can import the sample validation
Projects. For details, see “SWIFT Projects” on page 34.
SWIFT’s MFVR validation rules are known as semantic verification rules (SVRs) or semantic
rules, as opposed to the syntactic rules, which verify the syntax of the fields only. Syntactic
verification is built into each OTD.
SWIFT defines a total of 299 SVRs that are validated by the FIN network engine. SWIFT
Alliance Access or IBM’s Merva products do not implement these rules, mainly because there is
no functional model, and the implementation work is mostly manual. Each message type has to
be validated against a subset of these rules.
In addition this set of 299 SVRs, SWIFT has defined a new series of rules to help enable
straight-through processing (STP) in the securities industry. The OTD methods that validate
for MFVR compliance also validate for compliance with STP rules.
The SVR methods also implement the semantic validation functions used in the validation
functions, as defined by the current Message Format Validation Rules Guide.
Using this semantic validation, Java CAPS can verify the contents of each message before it is
sent into the FIN network, saving time and usage fees.
MFVR Errors
MFVR errors result from the application of the Semantic Validation Rules. Multiple errors are
possible, and they are given in the order in which they occurred and with the sequences, fields,
or subfields used to determine them.
For more information on error messages, see “Error Message Information” on page 46.
28 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
In Collaboration Validation Methods
The validation methods are available for the same SWIFT message OTDs listed under “Message
Validation Rules” on page 27. 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.
30 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
In Collaboration Validation Methods
Return Values
None.
Throws
com.stc.swift.validation.MPRException: Thrown when the OTD is invalid in regard to
applicable MPR rules.
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.*;
}
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) {
32 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
In Collaboration Validation Methods
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.
SWIFT Projects
Two sample projects, Swift_SAA_XMLv2_MQHA and SAG610_FTA_Sample.zip, are
provided with the SWIFT Message Library on the installation media. Additional samples can be
found on the Java CAPS samples site at http://java.net/projects/javacaps-samples/
pages/Home. You can import these projects directly into Java CAPS using the project import
utility.
■ To use the samples supplied with the SWIFT Message Library, copy the samples from the
installation media to a local directory.
The sample file are located in components/message_libraries/Swift/samples.
■ To use the samples provided on the sample site, navigate to the sample site at
http://java.net/projects/javacaps-samples/pages/Home, click Application Adapters,
and download the swift_otd.zip sample file. Extract the file to a local directory.
3 On the NetBeans toolbar, select Tools, point to CAPS Repository, and then select Import.
The Import Project dialog box appears.
4 Click Yes to continue the process, or click No to save your changes and repeat the previous step.
The Import Manager appears.
5 Browse to the directory that contains the sample Project zip file. Select the sample file and click
Import.
7 Before an imported sample Project can be run, you need to do the following:
34 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Projects and NetBeans
■ Create an Environment
■ Create a Deployment Profile
■ Create and start a domain
■ Build and deploy the Project
Note – The Batch Adapter is required when running the SWIFT MX Validation sample.
Sample Project
The Project's flow is represented in the Connectivity Map as follows:
Inbound File Adapter –> Schema Validation —> JMS Queue —> Generic Validation —> Batch Adapter, Outbound File Adapter
Descriptions of components
■ Inbound File Adapter – The File Adapter is used to read MX messages to be validated.
■ Schema Validation – Each MX message has a corresponding XSD Schema file. You must use
the XSD OTD Wizard to build an XSD OTD based on the schema file. In this collaboration,
the logic is to unmarshal the inbound message to the XSD OTD and then to marshal the
OTD to String and send the payload to JMS Queue. This process is to ensure the MX
message is well-formed and is validated against the XSD schema. For a different MX
message type, build the XSD OTD and create this simple collaboration.
Note – The sample project chooses the ”RedemptionBulkOrderV02” message and schema to
demo the usage. The RedemptionBulkOrderV02 schema is obtained from the SWIFTNet
Funds ver3.0 CD, which also contains all element types to be validated in the Generic
Validation collaboration.
36 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Projects and NetBeans
Note – You can place all XSD schema files in one directory. In Connectivity Map, set the
directory name in the Target Directory Name, under Target Location section in Batch
Local File configuration window. In Generic Validation, the collaboration will read the
input message and locate the associated schema file name, in the directory name
specified in Batch Adapter. Make sure the schema file name does not contain any illegal
character $. This $ character should be replaced with _ character in file name. For
example, schema file name swift.if.ia$setr.001.001.02 should be renamed to
swift.if.ia_setr.001.001.02and placed in the target directory.
Note – You must build your own XSD OTD and Schema Validation collaboration, based on
different MX message types to be validated. You can always reuse the Generic Validation
collaboration for all MX messages.
Prerequisites
You must have an Oracle database, version 9i or greater to run the project.
Installation steps
1. Install the database schema from the SCR_CreateUser.sql and SCR_CreateTable.sql files
(located in the SCR_Create_Cleanup.zip file).
2. Extract the contents of the SampleSCR.zip file into your local drive.
3. Import the SCRProject.zip file.
4. Set the environment variables (as shown in the figure below).
38 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Projects and NetBeans
40 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
SWIFT Projects and NetBeans
2. Select the 10 most recently updated transactions from the drop-down list. Messages that
have been held for review and resubmitting (e.g. messages that are duplicates, incorrect, or
awaiting approval) are displayed.
3. Select the message you wish to examine and click the Repair button. The Message Repair
window opens, displaying detailed information regarding the message.
4. You can resolve the message in the following ways:
■ Correct the message error and click the Resubmit button.
■ Examine a message that requires approval and click the Approve button.
■ Delete the message by clicking the Delete button
Updating BICDirService
The BICDirService feature is a database service. The data files used to populate BICDirService
must be updated periodically from SWIFT’s source CD-ROM issued once every four months.
Source of Information
The Java constructor for the BICDir class loads the required data from the following
SWIFT-supplied files:
■ FI.dat
■ CU.dat
■ CT.dat
The constructor takes an argument from the directory that contains these two files. It then
opens each file and loads the appropriate fields into a searchable structure. For more details on
these files, see the current SWIFT BIC Database Plus Technical Specifications document for
actual file layout and positioning information.
The data used to look up and validate comes from SWIFT’s own BIC bank files containing its
BIC codes and its currency and country codes. When necessary, SWIFT updates these files with
a new version of its lookup tables, to keep them current. You can upload these files to Java CAPS
and control when updates to the system occur and access these files via SWIFT updates.
Update Operation
The BICDirService feature allows multiple simultaneous objects to access its methods with
near-local object response times. The SWIFT standards are not always sufficiently complete to
enable STP. Currently a message can pass network validation but fail at the receiving end
because of incompatible definitions or codes, or because of missing data. The result is having to
manually repair or follow up on these messages and possible retransmission of the message.
42 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
Updating BICDirService
The SWIFT Message Library’s BICDirService ensures that valid, up-to-date BIC, country, and
currency codes are present in the messages processed through Java CAPS. This feature increases
the likelihood that a given message can flow “straight through”.
You must update the BICDirService information before running components that utilize this
feature. This procedure updates the BICDirService information.
1 In the NetBeans Projects window, expand CAPS Components Library > Message Library > Swift.
2 Right-click the bic.jar file, point to Version Control, and select Check Out. Click Check Out on
the dialog box that appears.
3 Right-click the bic.jar file again, and select Update BIC Files.
A browser window appears so you can browse to and select the files to update.
4 Navigate to the location of the CU.dat file on the SWIFT update CD-ROM. select the file, and click
Open.
5 Repeat the above two steps to update the FI.dat and CT.dat files.
■ Look up Currency Code by Country Code: Takes a string, a country code, and returns the
currency code. The signature is:
currencyCode getCurrencyCode(countryCode);
■ Look up Country Code by Currency Code: Takes a string, a currency code, and returns the
country code. The signature is:
countryCode getCountryCode(currencyCode);
BICDir Exceptions
The purpose of the exceptions is to give you some indication of what error has occurred and
how to rectify it.
Where:
■ “”: Marks static text.
■ XX: Stands for a unique number assigned to each error message.
■ error-message: A descriptive narrative derived from the condition that caused the error,
and a possible solution to rectify it.
44 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
Updating BICPlusIBAN
Updating BICPlusIBAN
The data files used to populate BICPlusIBAN directory must be obtained from SWIFT directly.
The sample BICPlusIBAN directory from SWIFT Message Library is only the test data files to be
used with the sample project. They are not intended to be used in a production environment.
The Java constructor for the BICPlusIBAN class loads the required data from the following
SWIFT-supplied files:
■ BI.TXT
■ IS.TXT
The constructor takes an argument from the directory that contains these two files. It then
opens each file and loads the appropriate fields into a searchable structure. For more details on
these files, see the current SWIFT BICPlusIBAN Directory Technical Specifications document
for actual file layout and positioning information.
The BI data contains the BICPlusIBAN information. The IS data provides IBAN structure
information. The SWIFT Message Library takes these data together to execute the validation
rules. These base files and update delta files should be obtained directly from SWIFT.
2 Right-click the BICPlusIBAN.jar file, point to Version Control, and select Check Out. Click Check
Out on the dialog box that appears.
3 Right-click the BICPlusIBAN.jar file again, and select Update BICPlusIBAN Files.
A browser window appears so you can browse to and select the files to update.
4 Navigate to the location of the BI.txt file on the SWIFT update CD-ROM. select the file, and click
Open.
ArrayList deriveBICfromIBAN()
■ Validating the Bank ID: This validation method is used to validate that the Bank ID
contained in an IBAN is a valid Bank ID. This can be useful in situations where the ordering
customer has constructed the IBAN. However, the validation does not guarantee that the
IBAN itself is valid. The method takes no arguments, and will return a boolean result. The
signature is:
boolean validateBankID()
■ Validating the BIC: This validation method is used to validate that the BIC is a valid BIC.
This can for example be useful in situations when the ordering customer attempted to derive
the BIC itself from financial institution's name and address. The method takes no
arguments, and will return a boolean result. The signature is:
boolean validateBIC()
■ Validating the BIC/IBAN combination: This validation method is used to validate that the
BIC and the IBAN belong to one and the same institution. The method takes no arguments,
and will return a boolean result. The signature is:
boolean validateBICIBANCombo()
Error Messages
There are separate error messages and reporting mechanisms for each type of validation
performed by a Service. You can control the amount of debugging information in the error
messages you receive by using the debug flags as parameters when you call the command()
method. The library’s error parser provides the following debug levels:
■ Regular Information: Gives general information, and if an error occurs, the path to the
node or piece of data that caused the error.
■ Debug: Gives all of the node information generated by the parse, that is, each field and
subfield.
■ Parser Debug: Combines the debug level with information regarding just what the parser is
matching, and the data being used. In general, you only need to use this level for situations
where the error cannot be determined using the other levels because of the quantity of data.
This level gives the exact location and nature of the failure.
Error message file output appears at the end of any message that generates an error.
46 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
Error Message Information
■ A or a: Enables the abbreviation of path names. This reduces the path output when you are
printing to a Regular Information set.
■ D or d: Enables Debug (mid-level) debugging. If enabled, this generates more debug data
than the Regular Information level, but less than the Parser Debug level.
■ I or i: Enables Regular Information level debugging.
■ L or l: Enables saving and display of the last successfully parsed node. When a parse has
failed, this information is the last item printed by the current root node.
■ P or p: Enables the Parser Debug-level information. If enabled, this generates the maximum
information about what the internal parser is doing.
Using the Debug Level flags, you can configure the debugging information you receive by
setting the appropriate debug parameter in the OTD’s command() method. For example, to set
the error message level to the Regular Information level (I flag), with abbreviations turned on
(A flag), you would set command() with the parameters A and I. You can do this from the
Collaboration Editor’s Business Rules Designer as displayed below.
FIGURE 1 Setting the debug level using the Business Rules Designer
This produces the following Java code (this example uses the mt_202 Validation Collaboration:
mt_202_1.command( "AI" );
Calling command() enables any of the debug functions presented as a parameter. For more
information, see the SWIFT Message Library Javadoc.
Message Examples
An example of a regular information-level parse error (cannot find a required field) is:
at 0: com.stc.swift.runtime.SwiftUnmarshalException: mt_103.Mt_103: 0:
Failed to parse required child(Data).
An example of a parse error with the debug level enabled (cannot find a required field) is:
Given this path to the data, you can determine where in the message the parser failed by looking
at:
■ The SWIFT User Handbook
■ The structure of the OTD in the NetBeans OTD Editor
■ The Javadoc for the OTD
See “MFVR Errors” on page 28 for MFVR-specific error information. For more detailed error
information, see “Error Message Information” on page 46.
The message goes on for several more lines, not indicating any error. Then the parser is looking
for any more 22a’s, F or H, and does not find one. See the following example:
The parser then looks for a 98a either option A|B|C as follows:
48 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
Using SWIFT FIN-Based Funds OTDs
The parser finds no repetitions, which does not fit in the required range of 1 to 3 as described in
the following example, so at this point, the parser fails, because no expected repetitions were
found:
In the past, many funds industry players have asked SWIFT to help automate these operations
by providing standards and connectivity between funds distributors, transfer agents, funds
management companies, and other intermediaries like funds processing hubs. To meet these
needs, SWIFT has developed standards and message templates based on these standards.
The SWIFT Message Library contains the following FIN-based MT Fund OTDs (see Table 12)
specialized for the associated SWIFT message types and fund operations:
mt_502_FUNDS FIN Order to buy and sell: for funds subscription, redemption, switch,
and cancellation.
mt_509_FUNDS FIN Order status: for status update on orders (for example, a rejection or
acknowledgement of a receipt).
These MT Fund OTDs apply to the funds message types in the ISO 15022 FIN Standard. The
Category 5 directory contains the SWIFT MT Funds message OTDs.
50 Oracle Java CAPS SWIFT Message Library User's Guide • December 2011
OTD Library Java Classes
In addition to the classes for OTDs, the following Java classes contain methods for runtime
operation:
■ SwiftMarshalException
■ SwiftOtdChild
■ SwiftOtdInputStream
■ SwiftOtdLocation
■ SwiftOtdRep
■ SwiftParseUtils
■ SwiftUnmarshalException