Using ASCIIChannel with Q2 - override message length to 2

57 views
Skip to first unread message

Allie Harrison

unread,
May 17, 2017, 6:29:14 PM5/17/17
to jPOS Users
I am implementing a custom packager and the format appears to be okay. The issue is that the system that I am connecting to expects a 2 byte message length just before the message. The ASCIIChannel defaults to a length of 4. Is there a way that I can override the length to be 2 in my channel_jpos xml file?

Here is the contents of the file:

<channel-adaptor name='jpos-channel' class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">
<channel class="org.jpos.iso.channel.ASCIIChannel"
packager="org.jpos.iso.packager.GenericPackager">
<property name="packager-config" value="cfg/allie.xml"/>
<property name="host" value="127.0.0.1" />
<property name="port" value="6600" />
</channel>
<in>jpos-send</in>
<out>jpos-receive</out>
<reconnect-delay>10000</reconnect-delay>
</channel-adaptor>

Andrés Alcarraz

unread,
May 17, 2017, 7:38:14 PM5/17/17
to jpos-...@googlegroups.com

Are you sure you need an ASCIIChannel? An ASCIICHannel with 2 bytes for length would only allow message of 99 bytes long, which is pretty short and surely not enough for most of iso8583 message fomats.

I'm pretty sure you need another channel implementation

What is the expected format of the lenght bytes?

Best regards

Andrés


El 17/05/17 a las 19:29, Allie Harrison escribió:
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/f5b33d59-405f-4309-b82c-4a97a849a614%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alejandro Revilla

unread,
May 17, 2017, 8:22:06 PM5/17/17
to jPOS Users
I agree with Andres, perhaps you need NACChannel.

How are those two bytes supposed to be encoded? Network Byte Order? Then NACChannel is your friend.




To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/f5b33d59-405f-4309-b82c-4a97a849a614%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.

Allie Harrison

unread,
May 18, 2017, 10:43:17 AM5/18/17
to jPOS Users
I forgot to include that bit of information, my apologies. The message length is being sent in hex format so basically the message they are expecting would be:

XXYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

Where XX is the message length in HEX and YYYY.... is the actual message in ASCII.

Andrés Alcarraz

unread,
May 18, 2017, 12:00:01 PM5/18/17
to jpos-...@googlegroups.com
Hi I guess that by hex you mean RAW as in hex max length would be
AA=16*16=256 is still low.

As Alejandro said you probably need NACChannel. But you should verify
that the most significant byte comes first (i.e. the first Y).

Hope this helps, but you should check the specifications with the code
of the channel to verify that.

Best regards

Andres


El 18/05/17 a las 11:43, Allie Harrison escribió:
> To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/c4858e4b-4836-4140-9b89-b0de055a07bd%40googlegroups.com.

Allie Harrison

unread,
May 18, 2017, 3:26:25 PM5/18/17
to jPOS Users
XX in their specification means that we send the length in hex which would be FFFF or 65,535 in decimal. Everything else about the ASCIIChannel works with this one exception. 

With my understanding of the NACChannel is that it sends [LEN][TPDU][ISOMSG], however I need to only send [LEN][ISOMSG]. Is it possible to have the NACChannel only send [LEN][ISOMSG]?

Apologies for the newbie questions. I know that I'm close. 

Regards,

Allie

Andrés Alcarraz

unread,
May 18, 2017, 3:33:37 PM5/18/17
to jpos-...@googlegroups.com

Sorry Allie first of all I meant FF=15*16+15=255

My point is that if you say FFFF=65535 then or you are sendign four characters 'F' as the length that's what hexa mean, or you are sending two bytes each with the value FF=255 which is not an hexa value but an hexa representation of the value.

On the other hand you can use NACChannel without defining a header (TPDU) and in that case it will not be expecting it nor sending it.

Regards

Andrés


El 18/05/17 a las 16:26, Allie Harrison escribió:

Alejandro Revilla

unread,
May 18, 2017, 4:55:46 PM5/18/17
to jPOS Users
NACChannel is your friend. If you don't specify a header (TPDU), then it would send LEN+MESSAGE and that's what you want. The Length will go in network byte order.

You call it "HEX" but it's actually not hex. You see it in hex when you print it or in your documentation, but it's just two bytes of data representing the message length in nbo (also called BIG ENDIAN).



To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.

Allie Harrison

unread,
May 19, 2017, 11:43:48 AM5/19/17
to jPOS Users
You are correct, the NACChannel works! Thank you everyone for all of your help! 


Alejandro Revilla

unread,
May 19, 2017, 4:34:59 PM5/19/17
to jPOS Users
Awesome. Thank you for the feedback.



Reply all
Reply to author
Forward
0 new messages