Implementing Client code without packager fields information from switch(Server)

40 views
Skip to first unread message

Charaka Wijesinghe

unread,
Jun 22, 2025, 7:57:06 AMJun 22
to jPOS Users
Hi Team, 

I have a question how to create the packager.xml(ISO fields definition) for client to use,

1. By looking at the ISO message can we derive the packager.xml ? 
2. Do we have any generic ISO channel , in the scenario where we don't know host system channel

I have using following 200  message which was share by host system. I don't have any other materials from switch(Server end)

Appreciate your assistance if we have any method to get the packager.xml done.

ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(packager);
isoMsg.setMTI("200");
isoMsg.set("2", "4747470000001122");
isoMsg.set("3", "000000");
isoMsg.set("4", StringUtils.leftPad("116.0", 12, "0"));
isoMsg.set("7", DateUtils.getTransmissionDate(new Date()));
isoMsg.set("11", {{STAN}});
isoMsg.set("12", DateUtils.getField12Iso("1207"));
isoMsg.set("13", DateUtils.getField13Iso("1105"));
isoMsg.set("14", "0808");
isoMsg.set("18", "3306");
isoMsg.set("22", "....");
isoMsg.set("25", "59");
isoMsg.set("41", "59002300");
isoMsg.set("42", "111110000012345");
isoMsg.set("48", "111110000077658");
isoMsg.set("48.1", "00221166");
isoMsg.set("49", "804");



Mark Salter

unread,
Jun 22, 2025, 9:12:04 AMJun 22
to jpos-...@googlegroups.com

Please ask them for the Packager, especially if they have shared the code given in your post, it might just be an oversight.

Failing that ask them for their documentation for the interface that they need or you want to use.

-- 
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 visit https://groups.google.com/d/msgid/jpos-users/e9a3b157-5a6d-4ce8-a296-67ef82bfbc30n%40googlegroups.com.
signature.asc

Charaka Wijesinghe

unread,
Jun 22, 2025, 9:25:44 AMJun 22
to jpos-...@googlegroups.com

chhil

unread,
Jun 22, 2025, 9:43:22 AMJun 22
to jpos-...@googlegroups.com

When you configure genericpackager and leave out the XML it's generic.

But the chances of that working are rare. You would need to get the specifications and write the XML if one provided by jpos is not available. There are a few provided by jpos yoh can look up in GitHub..


Mark Salter

unread,
Jun 22, 2025, 11:14:15 AMJun 22
to jpos-...@googlegroups.com
On 22/06/2025 14:25, Charaka Wijesinghe wrote:
> May I know any feedback for point 2?

I have nothing to offer - a random packager used against an unknown
target would only be a waste of time to contemplate, least of all try :-).

--

Mark

signature.asc

Charaka Wijesinghe

unread,
Jun 23, 2025, 12:12:48 PMJun 23
to jPOS Users
HI Mark and Chhil

I got the packager.xml and ISO message specification but still client receiving  peer rest response, (I believe this is due to the ISO message parsing error at the server end)

If you having any insight how to construct accurate ISO message please educate me, i tried with below ISO 0200 message and got peer disconnect with following exception


your help highly appreciated.

 Client Code 
System.setProperty("javax.net.debug", "ssl,handshake");
// Load the packager configuration
GenericPackager packager = new GenericPackager("cfg/jpos_fields.xml");

// Prepare TPDU (example: 60 00 03 00 00)
byte[] tpdu = new byte[] { 0x60, 0x00, 0x03, 0x00, 0x00 };

// Create and configure the ISO message
ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(packager);


 isoMsg.setMTI("0200");
isoMsg.set(0, "0200"); // MTI
isoMsg.set(1, "12345678"); // Bitmap
isoMsg.set(2, "123456789012345"); // Primary Account Number
isoMsg.set(3, "000000"); // Processing Code (Purchase)
isoMsg.set(4, "000100000000"); // Transaction Amount (in minor units)
isoMsg.set(11, "123456"); // System Trace Audit Number
isoMsg.set(39, "00"); // Response Code (00 for success)
isoMsg.set(41, "T1234567"); // Card Acceptor Terminal ID
isoMsg.set(42, "MERCHANT12345"); // Card Acceptor ID Code
isoMsg.set(49, "840"); // Transaction Currency Code (USD)
isoMsg.set(54, "000000000100"); // Additional Amount (e.g., fee amount)
// If host expects Field 48:
isoMsg.set("48", "015111110000077658"); // LLLVAR: 3-digit length + data
// Pack the ISO message (for debug)
byte[] isoData = isoMsg.pack();
System.out.println("isoData: " + ISOUtil.hexString(isoData));

// SSL properties
Properties props = new Properties();
props.setProperty("keystore", "D:/Dev/xx/JpossClientApp/src/main/resources/uw/client-truststore-bank.jks");
props.setProperty("storepassword", "changeit");
props.setProperty("keypassword", "changeit");
props.setProperty("serverauth", "false");

GenericSSLSocketFactory sslFactory = new GenericSSLSocketFactory();
sslFactory.setConfiguration(new SimpleConfiguration(props));

// Use NACChannel with SSL and TPDU
// NACChannel channel = new NACChannel(
// "ip", // Host
// port, // Port
// packager,
// tpdu
// );
ASCIIChannel channel = new ASCIIChannel(
"ip", // Host
port, // Port
packager
);
channel.setSocketFactory(sslFactory);

// Logging
Logger logger = new Logger();
logger.addListener(new SimpleLogListener(System.out));
channel.setLogger(logger, "client-channel");

// Connect to the server
channel.connect();
System.out.println("Connected to the server.");

// Send the ISO message
channel.send(isoMsg);
System.out.println("Message sent.");

// Receive the response
ISOMsg response = channel.receive();
System.out.println("Response received:");
response.dump(System.out, "");

// Disconnect the channel
channel.disconnect();


Error
===
vax.net.ssl|DEBUG|10|main|2025-06-24 24:07:07.975 MYT|SSLSocketImpl.java:1781|close the SSL connection (passive)
java.io.EOFException
at java.base/java.io.DataInputStream.readFully(DataInputStream.java:203)
at org.jpos.iso.channel.ASCIIChannel.getMessageLength(ASCIIChannel.java:111)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:712)
at org.isoclient.clientCode.main(clientCode.java:88)
<log realm="client-channel/193.150.122.222:20005" at="2025-06-24T00:07:07.975969800" lifespan="5475ms">
  <receive>
    <peer-disconnect/>
  </receive>
</log>
jpos_fields.xml
Specification.xlsx

Mark Salter

unread,
Jun 23, 2025, 3:34:45 PMJun 23
to jpos-...@googlegroups.com

I hope the owners of these documents gave you permission to publish their works on the internet

If not, do say as we can delete them, although that won't  do anything about any already made downloads or indexing etc.

Ask them what they don't like about your message? If you sent anything they don't seem to have liked it.

They may have changed stuff that they can only see or know.

Examine any examples messages they have shared, but don't share here.

They can help you in detail if they are happy to, we can only guess on a limited and one sided view

-- 
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.
signature.asc

Charaka Wijesinghe

unread,
Jun 23, 2025, 6:54:34 PMJun 23
to jpos-...@googlegroups.com
Hi Mark,

Understood. As you said, the client code need some addtional change to comply with the request.
 Thanks for your insight. Since I'm not continuing this thread, you may delete the conversation.

Thanks.

chhil

unread,
Jun 24, 2025, 10:51:42 PMJun 24
to jpos-...@googlegroups.com
Alternatively, see if they can send you a network message. Collect and analyze the dump, and you can work with it to fix your code :)


-chhil

Reply all
Reply to author
Forward
0 new messages