1

How to set direction to MT518 swift message model object in Prowide Core (WIFE). Direction indicates in message application header block(block2). eg. {2:O5181013160718MOTIITMMAXXX00000000101607181013N}

I want to set direction to following swift mt object.

MT518 m = new MT518()

but there is no setDirection() api method available in MT518 model type. setDirection() method available in AbstractSwiftMessage type object, but there is no relationship between that class and MT518 class in the library.

link to api http://api.prowidesoftware.com/core/

Can anybody familiar with Prowide Core (WIFE) library solve this.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
tech share
  • 37
  • 6

1 Answers1

2

By default messages created with the MTnnn classes are outgoing (input to SWIFT network). But you can always set the block 2 manually. Check out the following example and replace SwiftBlock2Input by SwiftBlock2Output

This will initialize all blocks, and inparticular for block 2 it will create a SwiftBlock2Input:

MT518 mt = new MT518();

To override the block 2 with you can just do something like this:

//create an instance of SwiftBlock2Output 
SwiftBlock2Output b2 = new SwiftBlock2Output();

//fill all required data for the block (notice it will be empty)
b2.setMessageType("518");
(...)

//overwrite the block in the mt object
mt.getSwiftMessage().setBlock2(b2);