I have two way implementation where i send and also receive request from a remote server. I am able to successfully send request and always get successful response. However when the client sends request to me, my packager complains. Updating the packager causes sending request to the client to fail. Below is my error and configuration.
<log realm="post-channel/XXX.XXX.XXX.XXX:7777" at="2020-10-19T18:45:05.561" lifespan="5248ms">
<receive>
<iso-exception>
org.jpos.iso.IFA_LLCHAR: Problem unpacking field 94 (org.jpos.iso.ISOException: Invalid character found. Expected digit.) unpacking field=94, consumed=324
org.jpos.iso.ISOException: org.jpos.iso.IFA_LLCHAR: Problem unpacking field 94 (org.jpos.iso.ISOException: Invalid character found. Expected digit.) unpacking field=94, consumed=324
at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:340)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:479)
at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:976)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:746)
at org.jpos.q2.iso.ChannelAdaptor$Receiver.run(ChannelAdaptor.java:332)
at java.lang.Thread.run(Thread.java:748)
</iso-exception>
10_channel.xml
<?xml version="1.0" encoding="UTF-8"?>
<channel-adaptor name="pesalink-channel" logger="Q2">
<channel class="org.jpos.iso.channel.ASCIIChannel" type="client" connect="yes" logger="Q2" realm="post-channel" packager="org.jpos.iso.packager.GenericPackager">
<property name="packager-config" value="cfg/customize.xml" />
<property name="host" value="XXX.XXX.XXX.XXX" />
<property name="port" value="7777" />
<property name="length-digits" value="6" />
<property name="connection-timeout" value="30000" />
<property name="timeout" value="300000" />
</channel>
<in>pesalink-channel-send</in>
<out>pesalink-channel-receive</out>
<reconnect-delay>10000</reconnect-delay>
<keep-alive>yes</keep-alive>
</channel-adaptor>
20_server.xml
<?xml version="1.0" ?>
<server name="server-receiving" class="org.jpos.q2.iso.QServer" logger="Q2">
<attr name="port" type="java.lang.Integer">7777</attr>
<channel name="channel-receive" class="org.jpos.iso.channel.NACChannel" packager="org.jpos.iso.packager.GenericPackager" logger="Q2">
<property name="packager-config" value="cfg/customize2.xml" />
</channel>
<request-listener class="com.test.linkListener" logger="Q2" realm="incoming-request-listener">
</request-listener>
<in>NETWORK_IN</in>
<out>NETWORK_OUT</out>
</server>
code to receive request
public class linkListener implements ISORequestListener{
private static final String FTREQUEST = "1200";
private static final String REVADVICE = "1420";
private static final String NETWORKREQ = "1804";
@Autowired
HttpHandler httpHandler;
Log log1;
@Override
public boolean process(ISOSource source, ISOMsg m) {
System.out.println("::::: Waiting :::::");
log.info("::::: Inside Listener :::::");
try {
String mti = m.getMTI();
System.out.println("mti ::: " + mti);
log.info("mti ::: " + mti);
switch (mti) {
case FTREQUEST:
log.info("Inside Financial Transaction Request");
String amt = m.getString(4);
Double amount1 = Double.parseDouble(amt);
Double amount2 = amount1 / 100;
String amount = String.format("%.2f", amount2);
log.info("amount formated ::: " + amount);
String stan = m.getString(11);
log.info("stan ::: " + stan);
String rrn = m.getString(37);
log.info("rrn ::: " + rrn);
String senderAccountNo = m.getString(102);
log.info("senderAccountNo ::: " + senderAccountNo);
String beneficiaryAccountNo = m.getString(103);
log.info("senderAccountNo ::: " + beneficiaryAccountNo);
m.set(39, "100");
m.setMTI("1210");
m.set(2, m.getString(2));
m.set(3, m.getString(3));
m.set(4, m.getString(4));
m.set(11, m.getString(11));
m.set(12, m.getString(12));
source.send(m);
break;
case REVADVICE:
log.info("Reversal Advice");
break;
case NETWORKREQ:
log.info("Network Management Request");
break;
}
} catch (Exception ex) {
ex.printStackTrace(System.out);
}
return true;
}
}