0

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;
    }
}
CryptoFool
  • 21,719
  • 5
  • 26
  • 44
Daniel Ameyaw
  • 83
  • 1
  • 10
  • How are you defining, sending and receiving these requests? Can you share the code with us? What does this XML have to do with anything? What system or code is reading this XML? This problem is so ill-defined that I doubt you'll get an answer without providing something more. – CryptoFool Oct 19 '20 at 18:20
  • i have updated my question with the code for receiving the request as advised... – Daniel Ameyaw Oct 19 '20 at 18:32
  • Ok. So I see that you're using [jPOS](http://www.jpos.org/). I've never used anything like it, and it's pretty opaque given just your code. I think help is going to have to come from someone who has used this jPOS stuff before, and that's not me. SO is a good place to look I guess, although you also might want to look for mailing lists, sites, or chat groups specific to that technology to have another chance at finding someone who knows this stuff enough to help you. Best of luck! – CryptoFool Oct 19 '20 at 22:27
  • The problem is that the format is different for network messages (aka x800) than for other types of requests like authorizations(x100), financials (x200), or reversals (x400)? or maybe there is a DE that is coming in those requests that is not correctly mapped and you didn't notice because is not present in 800/810 messages? – Andrés Alcarraz Oct 20 '20 at 16:00
  • It could help if you post raw hexdump of the different messages involved (signon/signoff) + what you are receiving but not able to parse, that and the definition of your packager – Andrés Alcarraz Oct 20 '20 at 16:02
  • you may also want to add a logger to your packager, in your channel configuration put: `` `` you will see what your packager is receiving and also where the fields start to look weird so you can see in which field packager definition the problem might be. – Andrés Alcarraz Oct 20 '20 at 16:05
  • @Andres,  Thanks for the support and time.I have updated the generic packager from XMLChannel to ASCIIChannel as advised. I have also added the logger to the packager and also corrected some fields which needed to be fixed.I have asked the 3rd Party to initiate a new request. I will revert with status of the outcome. – Daniel Ameyaw Oct 21 '20 at 00:50

0 Answers0