Coder Social home page Coder Social logo

Use Fixe Header about iso_8583 HOT 24 CLOSED

zemuldo avatar zemuldo commented on July 2, 2024 3
Use Fixe Header

from iso_8583.

Comments (24)

scalpovich avatar scalpovich commented on July 2, 2024 1

Thank for your feedback.

Im some case, messsge length goes to 4 caracters (so 2 bytes if i can assume) and header value need to be fixe.
As example, if i take this iso packet

[0090ISO701000001804.0...........]
here,

  • msgLength:: is this the length of the message excluding the msgLength itself? YES and here the value is 0090
  • fixedHeader:: will contain what? here it will be ISO70100000 But it can be other string
  • can I assume that Msg in your case is mti + bitmap + data. YES ofcourse thats the standard

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

Thanks for the complement, I had help ๐Ÿ˜Ž

You will have to explain what msgLength+fixedHeader+Msg contain as the library supports
2 byte message length indicator + Msg >> In this case Msg = mti + bitmap + data

So when you say

  • msgLength:: is this the length of the message excluding the msgLength itself?
  • fixedHeader:: will contain what?
  • can I assume that Msg in your case is mti + bitmap + data

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

Does fixedHeader have a fixed length and datatype? What is the description so that we can know how to consider it. If the fixedHeader has a variable length and cant be encoded in hex we have to also know how we will describe its length for building the string.

from iso_8583.

scalpovich avatar scalpovich commented on July 2, 2024

FixedHeader datatype is string. The header is normally required in all messages and varies depending on the host specs. FixedHeader length can be variable and do not consider in the message length.

Just need to prefix the message with an defined header after the msgLength.

So we can just let user defined the fixed or static header and set it as param

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

So if I get you well, this FixedHeader is a metadata that id defined by the user and will be the same on all outgoing messages? If so what about incoming messages?

If its static/fixed say ISO70100000 it will be present as is on all messages?

from iso_8583.

scalpovich avatar scalpovich commented on July 2, 2024

You get it.
THats the way. All messages in/outgoing should be get this header and it will be the same

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

Ah, great then! let me get back to you. I have some free time this evening, I can get that to a beta or even a new release as it's a useful feature.

from iso_8583.

scalpovich avatar scalpovich commented on July 2, 2024

Great then
thank you in advance

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

Hi @noecodjo I have implemented something we can test on a beta version 2.6.5-beta.0
To package with a static header, Initialize the main class with your custom configs and call setMetadata.
Once you know your incoming message has a static meta, you just call the same method again and it will be considered in the unpack process. Let me know if this works.
Here are some examples.

let data = {
    0: '0100',
    2: '4761739001010119',
    3: '000000',
    4: '000000005000',
    7: '0911131411',
    12: '131411',
    13: '0911',
    14: '2212',
    18: '4111',
    22: '051',
    23: '001',
    25: '00',
    26: '12',
    32: '423935',
    33: '111111111',
    35: '4761739001010119D22122011758928889',
    41: '12345678',
    42: 'MOTITILL_000001',
    43: 'My Termianl Business                    ',
    49: '404',
    52: '7434F67813BAE545',
    56: '1510',
    123: '91010151134C101',
    127: '000000800000000001927E1E5F7C0000000000000000500000000000000014A00000000310105C000128FF0061F379D43D5AEEBC8002800000000000000001E0302031F000203001406010A03A09000008CE0D0C840421028004880040417091180000014760BAC24959',
  };

 const staticMeta = 'ISO70100000';
 let isopack = new Main(data);
 isopack.setMetadata(staticMeta);
// Create buffer that has static data
 let buffer = isopack.getBufferMessage();
 new Main().setMetadata(staticMeta).getIsoJSON(buffer,{})

from iso_8583.

scalpovich avatar scalpovich commented on July 2, 2024

thank for your revert.
I just make an npm update of the app using the beta version,
Kindly assist.
I want to connect it to my host using address and port and automaticaly send network management msg
I mean send iso packet to host. what's the function who permit that.

Also get issue with setMetadata function

image

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

I have added an example here with the implementation I have done for using static header.
If you need an example that has message sending and conversion, checkout the example with client and server with automatic scheduled network messages exchange.
The setup in the example has a working client server setup that will be applicable to any scenario.

The library acts as a middle ware for converting messages between the server and the client and vise versa

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

FYI to use the beta version, run npm i --save [email protected]

from iso_8583.

scalpovich avatar scalpovich commented on July 2, 2024

thank for your revert.
Sorry for the delay
i just test your new implementation in new project and when i send data to host i get some issue. Host disconnected my client at once
In your example you getIsoJson. Iso Host does not support this format so i use the getBufferMessage function instead of getIsoJson.
image

So maybe the actuel beta version of iso_8583 doea not support iso version 93 were MTI started by 1xxx. as exemple network management will be 1804 instead of 0800.

Kindly assist

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

@noecodjo version 93 is supported and the types are defined here
I am not sure if 1804 is a valid type, if so, we will have to add it.

from iso_8583.

scalpovich avatar scalpovich commented on July 2, 2024

Hi Danstan,
Well noted,
i takea look in your library and i see where version 93 was implemented.
I juste modify the MTI 1800 and 1810 to 1804 and 1814 according to my host specs.
NOw i connect the client to the host. It's ok .

But according to my host specifications, each connection request should pass through network management by sending an 1800.
But when i try your method and send the buffer i get issue and the message never going to host interface.
image

see my code here

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

@noecodjo
The example considers only version 87 so if you look at the server at line 47 you will see it only handles 0800 message and responds to network message.

You can set the server to respond to other network messages by adding cases there.

The link you shared seems to be leading to a private repository so I cant see anything.

from iso_8583.

scalpovich avatar scalpovich commented on July 2, 2024

Sorry
KIndly retry the link
Thank for your revrt.
But my issue is that how sending data to host. I try th this but host never get it

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

I think am now mixed up. Could you bullet the issues you have again so that I understand how to help you.

from iso_8583.

scalpovich avatar scalpovich commented on July 2, 2024

after analyse from host , message length does not send in buffer.
Below how i pack it

let new_signon = {
0: '1800',
7: '1005231800',
11: '123456',
24: '801',
33: '101010',
37: '123456789123',
128: '00000000',
};
const staticMeta = 'ISOxxxxxxx';
const isopack = new Iso_8583(new_signon);
isopack.setMetadata(staticMeta);
const buffer = isopack.getBufferMessage();

client.write(isopack.getBufferMessage(), () => { log.info('sign on Message write finish'); });

Seems like msg length not pack well in header.

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

This is working in version 2.6.5-beta.0 as in your example.

const Iso_8583 = require('./lib/8583')

let new_signon = {
    0: '1800',
    7: '1005231800',
    11: '123456',
    24: '801',
    33: '101010',
    37: '123456789123',
    128: '00000000',
    };
    const staticMeta = 'ISOxxxxxxx';
    const isopack = new Iso_8583(new_signon);
    isopack.setMetadata(staticMeta);
    const buffer = isopack.getBufferMessage();

    console.log(buffer.toString())

    console.log(isopack.getIsoJSON(buffer))

And the output

โ•ญโ”€โ–‘โ–’โ–“ ~/Code/iso_8583 | on support-static-metadata ?1 โ–“โ–’โ–‘ยทยทยทยทยทยทยทยทยท
ISOxxxxxxx?1800๏ฟฝ ๏ฟฝ100523180012345680106101010123456789123
{ '0': '1800',
  '7': '1005231800',
  '11': '123456',
  '24': '801',
  '33': '101010',
  '37': '123456789123',
  '128': '00000000' }
                                                                                                                                                     
โ•ญโ”€โ–‘โ–’โ–“ ~/Code/iso_8583 | on support-static-metadata ?1 โ–“โ–’โ–‘ยทยทยทยทยทยทยทยทยทยท

from iso_8583.

scalpovich avatar scalpovich commented on July 2, 2024

Hi Dan,
Seems like message lengthHeader is not pack on message buffer.
I see in getBufferMessage() function that you dont ad the message length
Thats why host do not parse it as well
If i do like that is it ok?

getBufferMessage() {
const staticMetadataBuf = addStaticMetaData(this);
let _0_127_Buffer = this.assemble0_127_Fields();
if (_0_127_Buffer.error) {
return _0_127_Buffer;
} else {
let len_0_127_1 = T.getTCPHeaderBuffer(
parseInt(Number(_0_127_Buffer.byteLength) / 256, 10)
);
let len_0_127_2 = T.getTCPHeaderBuffer(
parseInt(Number(_0_127_Buffer.byteLength) % 256, 10)
);
//noe impl
let msgLength = _0_127_Buffer.length;
return Buffer.concat([msgLength.toString(), staticMetadataBuf, len_0_127_1, len_0_127_2, _0_127_Buffer]);
//noe impl

}
}

Cause the messageLength (4 first positions) in string should come first before TPDU static header

kindly explain the role of this values len_0_127_1, len_0_127_2

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

The length indicator is default to be calculated as
1st Byte as buffer-length/256 --- len_0_127_1
2nd Byte as buffer-length %256 --- len_0_127_2

from iso_8583.

scalpovich avatar scalpovich commented on July 2, 2024

Hi
seems like headerLength has not concat well in the msg.
According to your implรฉmentation, msgLength is add after fixHeader.
Normally we should have msgLength(4 bytes)+fixedHeader+Msg

from iso_8583.

zemuldo avatar zemuldo commented on July 2, 2024

Hi, could you check this on the version here https://www.npmjs.com/package/iso_8583/v/2.6.5-beta.1

from iso_8583.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.