Closed scalpovich closed 4 years ago
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?Msg
in your case is mti
+ bitmap
+ data
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
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.
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
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?
You get it. THats the way. All messages in/outgoing should be get this header and it will be the same
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.
Great then thank you in advance
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,{})
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
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
FYI to use the beta version, run npm i --save iso_8583@2.6.5-beta.0
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.
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
@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.
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.
see my code here
@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.
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
I think am now mixed up. Could you bullet the issues you have again so that I understand how to help you.
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.
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 ▓▒░··········
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
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
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
Hi, could you check this on the version here https://www.npmjs.com/package/iso_8583/v/2.6.5-beta.1
Hi @Zemuldo, Hope you are doing well. First of all I want to congratulate you for the work done.
In addition, is it possible to use string fixed header concatenated at the beginning of the message just after the size?
for example : msgLength+fixedHeader+Msg