1

I trying to create an ISO 8583 message using the openiso8583 library

It did not have field no 17 (Date, capture) so I extended the class.

Iso8583Finacle msg = new Iso8583Finacle();
msg.MessageType = Iso8583.MsgType._0120_AUTH_ADV;

msg[Iso8583Finacle.Bit._003_PROC_CODE] = "310000";
msg[Iso8583Finacle.Bit._004_TRAN_AMOUNT] = "0000000000000000";
msg[Iso8583Finacle.Bit._011_SYS_TRACE_AUDIT_NUM] = "380767397537";

msg[Iso8583Finacle.Bit._012_LOCAL_TRAN_DATETIME] = "20131003075957";
msg[Iso8583Finacle.Bit._017_CAPTURE_DATE] = "20131003";

However, it is throwing an error.

UnknownFieldException was unhandled
Field 17 is unknown

Can anyone tell me how to properly extend the message class?

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Chandra Eskay
  • 2,163
  • 9
  • 38
  • 58

2 Answers2

1

When you extend the class, you need to override the CreateField method to return the correctly formatted field. Have a look at the wiki page for extending a message

https://code.google.com/p/openiso8583net/wiki/ExtendingIso8583

John Oxley
  • 14,698
  • 18
  • 53
  • 78
1

The root of your problem would be DE017 is supposed to have a length of 4 in MMDD format, you are supplying a YYYYDDMM format date to a field that is both too large and also may not pass some edit checks as even if it attempted to truncate it it couldn't do month = 20 as that is invalid.

CRSouser
  • 658
  • 9
  • 25