Create jPOS Custom XML Channel not ISO8583 Format

Today, i have new project for creating TCP server and client for electronic financial transaction.
Actually, i feel strange to the requirment because we have to sent xml messaging through an TCP, my big question is WHY DONT YOU USE HTTP??? and my boss said, “we have to coddling the clients!” so i can’t say anything.

I am jPOS ISO8583 framework fanatics, so i want to use jPOS for this project. My big problems is, the messaging is not ISO8583 format, so i have to custom to fits the jPOS framework work flow. Then, i look the sample request, response message and getting a big idea *i think*. I want to Create jPOS Custom XML Channel ISO8583 Format and put the xml message into jPOS ISOMsg class.

So, the only solution is write my own Custom Channel and i have to use XMLPackager because these packager is not specify the bit length or bit type (IFCHAR, IFA_LLLCHAR, etc). The messaging specification is [len][xml_data], so in my mind i have to overide the sendMessageLength(len) and getMessageLength() methods because i need to read message based on length.

The second thing is i have put the xml message into ISOMsg format. In this case, i will overade the send() and receive() methods. The xml message key is on attribute SvcRqId and i need to read the value, and put into bit 11 (STAN) and bit 41 (Terminal Data), so i use SAX library to achieve that.

I just manipulate the byte message data so, it can fits into jPOS framework work flow, here the methods for creating ISOMsg from xml:

* Create ISOMsg and set the key (bit 11 / 41) based on SvcRqId tag
* @param xmlMsg
* @return ISOMsg
public static ISOMsg createMsg(String xmlMsg){
ISOMsg msg = new ISOMsg();
try {
String svcRqId = JposUtil.getXMLAttrValue(xmlMsg, Constant.SVCRQID_TAG);
msg.set(11, JposUtil.subString(svcRqId, 6, true));
msg.set(41, JposUtil.subString(svcRqId, 16, false));
msg.set(126, xmlMsg);
} catch (ISOException e) {
return msg;
Thats all my post about

Create jPOS Custom XML Channel not ISO8583 Format

11 responses to “Create jPOS Custom XML Channel not ISO8583 Format”

  1. PHENOM Avatar

    why dont use xmlchannel? it`s different?

    1. Didik H Avatar

      Yes, its different. you can see the XMLChannel message specs, xml channel doesn’t read the message length, and the tag is must be like this


      My message specs is [len][xml body], and the tag is something like this (the front end system existing messaging):


      so, i have to create custom xml channel that put the message into ISOMsg object for jPOS core processing. (extends the XMLChannel and must use XMLPackager)

      Thank you for your question phenom.

  2. Rj Avatar

    Great idea !!!

    1. Didik H Avatar

      Thanks Bro šŸ˜€

  3. phenom Avatar

    ah..thank you very much for your explanation and sample message..

    1. Didik H Avatar

      You’re welcome, thanks for visiting my blog. šŸ™‚

  4. nomatterwhoiam Avatar

    ngeri ganz

  5. Francisco Avatar

    You’ve done something with SOAP messages

    1. Didik H Avatar

      Hi, do you mean creating SOAP listener on top of jPOS?

    2. Francisco Avatar

      So is
      Right now I work on something to get http-soap in JPOS.
      Although nothing is concluded here is the repo

  6. Moses Avatar

    Link is broken please

Leave a Reply

Your email address will not be published. Required fields are marked *