Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iso8583Decoder doesn't handle messages with header #41

Open
ouadi opened this issue Feb 26, 2018 · 5 comments
Open

Iso8583Decoder doesn't handle messages with header #41

ouadi opened this issue Feb 26, 2018 · 5 comments

Comments

@ouadi
Copy link

ouadi commented Feb 26, 2018

The Iso8583Decoder doesn't handle messages with header.

The parseMessage() at line 29 in Iso8583Decoder
final IsoMessage isoMessage = messageFactory.parseMessage(bytes, 0);

Is called with second argument set to 0.

Shouldn't be called with second argument set to the length of the header?

@ouadi
Copy link
Author

ouadi commented Feb 27, 2018

Well, the j8583 library doesn't help much in this case. The MessageFactory requires that the user should know beforehand whether the header is present or not and in case it is present, he should know its length and type (ascii or binary).

I have created an enhancement request for our friends in j8583.

In case the enhancement is accepted, there will be:

  • either a new method in T Messagefactory.parseMessage(byte[]) that will lookup header presence, length and type from the iso8583-config file,
  • or two new methods Map<Integer, String> getIsoHeaders() and Map<Integer, byte[]> getBinaryIsoHeaders() that will give access to the configured headers.

I will post updated on my request here once it is resolved.

@kpavlov
Copy link
Owner

kpavlov commented Feb 27, 2018

@ouadi, thank you for investigation

@kpavlov
Copy link
Owner

kpavlov commented Nov 27, 2018

j8583 repo has moved here: https://bitbucket.org/chochos/j8583
The most recent release is still 1.12.0, but there is some activity there

@danicaliforrnia
Copy link

The Iso8583Decoder doesn't handle messages with header.

The parseMessage() at line 29 in Iso8583Decoder
final IsoMessage isoMessage = messageFactory.parseMessage(bytes, 0);

Is called with second argument set to 0.

Shouldn't be called with second argument set to the length of the header?

Hi ouadi, did you find a solution for this?

@ouadi
Copy link
Author

ouadi commented May 16, 2021

Yes, indeed

It has been long time

I remember very vaguely the solution I have implemented

I will share with you what I recall, but it could be incomplete:

  • I have extended IsoMessage and call it SidMessage. Two constructors of SidMessage that accept a header either in plain or binary format
  • and MessageFactory<SidMessage> and call it SidMessageFactory
  • The createIsoMessage(String header) and createIsoMessageWithBinaryHeader(byte[] binHeader) have been overwritten to return SidMessage instances
  • parseMessage(byte[] buf, int isoHeaderLength) and parseMessage(byte[] buf, int isoHeaderLength, boolean binaryIsoHeader) have been overwritten to take into consideration the length of the underlying header.

Hope this will help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants