The SWIFT MX Validation sample demonstrates what types of ”Generic Validations” are done on MX messages and how they are applicable. The sample zip file contains the following directory structure:
Input Data — MXSample_input.xml.fin – Sample MX message to be read by inbound File eWay.
jcdSchemaValidation.java – Java collaboration to validate MX messages against relevant XSD schema.
jcdGenericValidation.java – Java collaboration to validate MX messages against Extended Validation Rules.
Output Data – MX_GenericValidationLog_output1.dat – This is a log file for validation results from the jcdGenericValidation java collaboration.
Sample Project – SwiftMXSample.zip: This is the sample project.
XSD Data — XSD Schema file () to be validated against the MX input message: RedepmptionBuldOrderV02.xsd and swift.if.ia_setr.001.001.02.xsd.
The Batch eWay is required when running the SWIFt MX Validation sample.
The Project's flow is represented in the Connectivity Map as follows:
Inbound File eWay –> Schema Validation —> JMS Queue —> Generic Validation —> Batch eWay, Outbound File eWay. These are explained further below.
Inbound File eWay – The File eWay 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.
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.
JMS Queue – JMS Queue to hold schema validated messages.
Generic Validation Collaboration – This collaboration contains a set of generic validatio rules, which SWIFt recommends must be applied to an MX message. You can reuse this collaboration to validate all MX Message types. The generic validation rules validate the following identifiers and codes in a MX message:
Verifying BIC (datatype: BICIdentifier), against existence in the BIC directory (ISO 9362)
Verifying BEI (datatype: BEIIdentifier), against existence in the BEI list on SWIFTNet
Verifying ActiveCurrencyAndAmount (datatype: ActiveCurrencyAndAmount), against existence in Currency Code and number of valid decimal digits (ISO 4217)
Verifying Country Code (datatype: CountryCode), against existence in Country Code list (ISO 3166)
Verifying IBAN Identifier (datatype: IBANIdentifier), against IBAN structure as provided by ISO 13616
Verifying BICOrBEI (datatype: AnyBICIdentifier), against existence in the BIC list on SWIFTNet
Verifying ActiveCurrency (datatype: ActiveCurrencyCode), against existence in Currency Code list on SWIFTNet
Verifying ActiveOrHistoricCurrency (datatype: ActiveOrHistoricCurrencyCode), against existence in Currency Code list on SWIFTNet
Batch eWay – The Batch (Local File) eWay is used to read XSD files for Generic Validation. Place all XSD schema files in one directory and make sure the name of the XSD file matches the target namespace specified in the MX message. For example, in the sample input file, there is:
xmlns:Doc=”urn:swift:xsd:swift.if.ia$setr.001.001.02
Therefore the matching schema file name must be swift.if.ia_setr.001.001.02. Please rename the $ character to _, because the $ character is not considered a valid file name pattern in Java.
In Java CAPS, you must open the BAtch eWay configuration in the connectivity map (and under the Target Location node) and make sure the directory name for the XSD files are set to Target Directory Name field.
Outbound File eWay – The File eWay is used to log validatino results and error messages in Generic Validation.
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 eWay. 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.
To run the MX Sample Project, complete the following steps.
Import the SWIFT OTD Library SAR file.
Import the sample project.
In eDesigner, under Sun SeeBeyond > OTD Library > Swift, right-click on bic.jar and update CT, CU, and FI bic data files.
In the Connectivity Map, make sure the directory name and the file name in both the File eWay and Batch eWay are valid.
In the Environment, make sure the directory name for the File eWay is valid.
Under the project, create a new Deployment Profile and map all components.
Build and Deploy the project.
Send the input file to the inbound File eWay and watch for the outbound file.
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.