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: