Add header to ISO message

2,140 views
Skip to first unread message

Suranga

unread,
Jul 2, 2009, 3:46:15 AM7/2/09
to jPOS Users

I'm going to communicate with Base24 BIC interface (1987 standard) and
I need to add a header to ISO message .

Header = "ISO 020000011"

Rest is primary bit map and data elements . So could some one kindly
tell me a way to add above header to ISO message.

Many Thanks.

Chhil

unread,
Jul 2, 2009, 5:11:23 AM7/2/09
to jpos-...@googlegroups.com
Header adding has been covered on this list. Search the list and you
will find samples of doing it via java code or through configuration
files

-chhil

Suranga

unread,
Jul 2, 2009, 6:57:15 AM7/2/09
to jPOS Users
Hi All,

Thanks Chhil ,

I used ISOMessage.setHeader() method to add a header to ISO message

// Code

String header="ISO010100011";

byte[] bytearray=header.getBytes();

m.setHeader(bytearray);

// End code

but when i see message at a log I can message header as
<header>49534F303130313030303131</header> .It is obvious that I can
see it in that way . But I want to send header as a String
( ISO010100011 ) . So is there a any way to handle the header in that
way. Kindly assist me .

Many Thanks.

chhil

unread,
Jul 2, 2009, 7:02:59 AM7/2/09
to jpos-...@googlegroups.com
I believe the data being sent on the wire be fine....this is the data that is being printed and if you look at the code of Baseheader
the dump is doing a hexstring of the header else you wont see the special unprintable chars...

  public void dump (PrintStream p, String indent) {
        if (header != null) {
            p.println (
                indent 
              + "<header>" + ISOUtil.hexString (header) + "</header>"
            );

Suranga

unread,
Jul 2, 2009, 7:31:25 AM7/2/09
to jPOS Users
Thanks again for you clarification.

I got to know that we can set a header to the channel as a example

new NCCChannel(server,port,packager,header) but some channels are not
supported and I'm using BASE24TCPChannel which is also not supported.
is it same with ISOMessage.setHeader() or what is the difference .

Many Thanks,
Suranga.




On Jul 2, 5:02 pm, chhil <chil...@gmail.com> wrote:
> I believe the data being sent on the wire be fine....this is the data that
> is being printed and if you look at the code of Baseheaderthe dump is doing

David Bergert

unread,
Jul 2, 2009, 8:00:48 AM7/2/09
to jpos-...@googlegroups.com

Mark Salter

unread,
Jul 2, 2009, 8:43:18 AM7/2/09
to jpos-...@googlegroups.com
Suranga wrote:

> new NCCChannel(server,port,packager,header) but some channels are not
> supported and I'm using BASE24TCPChannel which is also not supported.
> is it same with ISOMessage.setHeader() or what is the difference .

Yeah, it can be a bit confusing; just like this sentence is.

The header on the Channel would be the place to specify one that is
fixed for the life of the channel.

The ISOMsg could be given a header, but especially when the header
varies for each message.

If you have a header that never varies, you can hope your chosen Channel
takes a header in on it's constructor (or modify it to).

The BaseChannel class checks for a specific ISOMsg.header and use it, if
not it will use the Channel.header - if one is present.

BaseChannel.setOverrideHeader(true) could be used to reverse the
precedence ISOMsg.header has over Channel.header.

--
Mark

Suranga

unread,
Jul 3, 2009, 2:08:26 AM7/3/09
to jPOS Users
Thanks all for clarify me about all the information and I manged to
add header to message.

One thing I want to know is

Before sending a message through a channel is it necessary to add
packager and pack the message or what is the purpose. Because after
set packager and pack the message I can only see bit map on message
logger (I have already uncommented the entries in dump method ) Kidly
advice.

methods
--------------
ISOMsg.setPackager();
ISOMsg.pack();

Sample OutPut
-----------------------
<isomsg>
<header>49534F303031313031313534</header>
<field id="0" value="0800"/>
<field id="bitmap" value="{7, 11, 33, 70, 94}" type="bitmap"/>
<field id="7" value="123"/>
<field id="11" value="123"/>
<field id="33" value="123"/>
<field id="70" value="123"/>
<field id="94" value="123"/>
</isomsg>

Many Thanks,
Suranga

Mark Salter

unread,
Jul 3, 2009, 3:01:15 AM7/3/09
to jpos-...@googlegroups.com
Suranga wrote:
> Thanks all for clarify me about all the information and I manged to
> add header to message.
>
> One thing I want to know is

You should get the programmers guide - honestly.

>
> Before sending a message through a channel is it necessary to add
> packager and pack the message or what is the purpose.

An ISOMsg needs a packager if it is going through a Channel.

The Channel will be calling the ISOMsg.pack() method you see, which in
turn will call it's Packager.pack() method to gather the raw bytes for
the Channel to send over the network.

--
Mark

Message has been deleted

Hamed Dinari

unread,
Sep 14, 2024, 2:37:05 PM9/14/24
to jPOS Users
I spent a few days trying to add a header to ISOMsg using msg.setHeader("ISO2003"), or setHeader in the NACChannel constructor, and sending it to the channel (both ASCII and NACChaneel) but none worked. when calling the unpack() method it has an error, for example, error unpacking field 64, or error unpacking field 2, ... please help me.
Thanks.

Mark Salter

unread,
Sep 14, 2024, 5:24:52 PM9/14/24
to jpos-...@googlegroups.com

How? 
Share your code and actual output?

Ask a smart question for a change please.

-- 
Mark



-------- Original Message --------
--
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/5c7fcd14-1d2f-4402-bb7f-9be605ac335an%40googlegroups.com.
signature.asc
Reply all
Reply to author
Forward
0 new messages