Friday, June 15, 2007

A4SWIFT ACK NAK schema has an error

It's been a while since a purely technical post but having gone to a Microsoft conference put me in the mood.

I've been working with the A4SWIFT accelerator for BizTalk 2006 a lot lately and ran across a few challenges. One that I didn't find any documentation for was that the ACK and NAK messages that come back from SWIFT do not validate against the schema provided in the accelerator or in the new 2006 message pack. The error you get when running Validate Instance in VS2005 is one like:

error BEC2004: Unexpected data found while looking for:
'}'
The current definition being parsed is AllianceTrailerBlocks. The stream offset where the error occured is 65. The line number where the error occured is 1. The column where the error occured is 65.

I looked at the message produced when I use the Generate Instance option on the schema, and noticed that there is an imbalance in brackets. There is one too many of these } present. The generated instance looks like the following (I've added whitespace to make reading easier):

{1:ASeLTAddressSessSequen}
{4:{177:DateTime}{451:AcceptReject}{405:ErrLin}{108:MessageUserReference}}
{5:
{MAC:AuthenticationResult}
{PAC:AuthenticationResult}
{CHK:Checksum}
{SYS:TimeAndInputReference}
{TNG:}Training
{PDE:TimeAndInputReference}
{DLM:}DelayedMessage
}
{S:{AllianceTrailerData}}
}
Notice the bracket that is in red, it turns out to be the one that is extra. To get rid of it, go to the Swift Trailer, Alliance Trailer Blocks, Repeating Trailers Alliance Trailer Data and set the child delimiter type to 'None'. This fixes the schema so that actual SWIFT ACK and NAK messages are validated. The exact location of the node is

/*[local-name()='SWIFT_CATEGORYS_MTS21_FIN_ACKNAK_Interchange' and namespace-uri()='http://schemas.microsoft.com/BizTalk/Solutions/FinancialServices
/SWIFT/CategoryS/MTS21_FIN_ACKNAK']/*[local-name()='SWIFTTrailer' and namespace-uri()='']/*[local-name()='AllianceTrailerBlocks' and namespace-uri()='']/*[local-name()='RepeatingTrailers' and namespace-uri()='']/*[local-name()='AllianceTrailerDataRecord' and namespace-uri()='']

Once the fix is in place, the generated instance looks like :

{1:ASeLTAddressSessSequen}
{4:{177:DateTime}
{451:AcceptReject}
{405:ErrLin}
{108:MessageUserReference}
}
{5:{MAC:AuthenticationResult}
{PAC:AuthenticationResult}
{CHK:Checksum}
{SYS:TimeAndInputReference}
{TNG:}Training
{PDE:TimeAndInputReference}
{DLM:}DelayedMessage
}
{S:{AllianceTrailerData}
}

I was surprised to see that this hasn't been blogged about before since I can't see how anyone would get the ACK and NAKs to work with the existing schema.

1 comment:

mohammed barqawi said...

Hi
can you help me
i want to use SWIFT_CATEGORYS_MTS21_FIN_ACKNAK_Interchange
as message header in patch files