public class UnionPayChannel extends BaseChannel
@Override
protected void sendMessageHeader(ISOMsg m, int len) throws IOException {
ISOHeader h = new UnionPayHeader(srcid, dstid, len);
if (h instanceof UnionPayHeader)
((UnionPayHeader) h)
.setTotalMessageLength(UnionPayHeader.LENGTH + len); // <-- You are probably not doing this i.e. header length 46 + length of message
serverOut.write(h.pack());
}
and the UPIHeader
public void setTotalMessageLength(int totalMessageLength) {
byte[] temp = ISOUtil.zeropad(totalMessageLength, 4).getBytes();
System.arraycopy(temp, 0, header, 2, 4); // <-- The header loacation where the message length is placed.
}
The message length is embedded in the header.
* Fld 1: Header Length 1B (Byte 0)
* Fld 2: Header Flag 1B (Byte 1)
* Fld 3: Total Message Length 4B (Byte 2 - 5)
So when you pack and unpack the message you need to get the length from the right place and know where the message starts from (after the 46 bytes).
-chhil
--
--
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 a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/ABSz_VDVEsQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/2441f6a2-2fc5-4f5b-8ef7-075c8b40ae69n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/ed50edd3-7cbb-424e-aa41-bc3a41e32027n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/77c4f31d-8e11-428d-90c6-03bd73d2b773n%40googlegroups.com.