0

I got the following code snippet:

final ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(packager);
isoMsg.setMTI("0800");
isoMsg.set(3, "9A0000");
isoMsg.set(7, ISODate.formatDate(now, "MMddHHmmss"));   
isoMsg.set(11, "123456");
isoMsg.set(12, ISODate.formatDate(now,"HHmmss"));    
isoMsg.set(13, ISODate.formatDate(now,"MMdd"));         
isoMsg.set(41, "20390040");
isoMsg.set(62,"0100820390040");
XMLChannel channel = new XMLChannel("xx.xx.xx.xxx", 1234, packager);
            try{

                logger.addListener(new SimpleLogListener(System.out));
                //channel.setPackager(packager);
                channel.setLogger(logger, "server-request-channel");
                channel.setTimeout(30000);
                channel.setHeader(isoMsg_.pack());
                channel.connect();
            }catch (Exception ex){
                System.out.println(ex.getMessage());
            }

            try{
                channel.send(isoMsg_);                      
                ISOMsg serverResponse = channel.receive();
                Log.i("response",new String(serverResponse.pack()));
            }catch(ISOException ex){
                System.out.println(ex.getMessage());
            }catch(Exception e){
                System.out.println(e.getMessage());
            }

I get a "peer disconnect" message any time it falls on the following line:

ISOMsg serverResponse = channel.receive();

the following is the log

<log realm="server-request-channel/xx.xx.xx.xx:1234" at="Fri Aug 14 11:06:04 WAT 2015.900">
    <connect>
        xx.xx.xx.xx:1234
    </connect>
 </log>

<log realm="server-request-channel/xx.xx.xx.xx:1234" at="Fri Aug 14 11:06:04 WAT 2015.927">
    <send>
        <isomsg direction="outgoing">
            <field id="0" value="0800"/>
            <field id="3" value="9A0000"/>
            <field id="7" value="0816210554"/>
            <field id="11" value="123456"/>
            <field id="12" value="210554"/>
            <field id="13" value="0816"/>
            <field id="41" value="20390040"/>
            <field id="62" value="0100820390050"/>          
        </isomsg>
    </send>
</log>

<log realm="server-request-channel/41.58.130.138:55533" at="Fri Aug 14 11:06:04 WAT 2015.958">
    <receive>
        <peer-disconnect/>
    </receive>
</log>

I don't know if I am not doing the right thing or there is something I am missing. This is suppose to be a simple(I suppose) network management request. How do I solve this?

Sunday Okpokor
  • 721
  • 6
  • 18

2 Answers2

3

The remote end probably doesn't like your message (channel could be wrong, packager could be wrong, header could be wrong) and closes the connection as soon as it gets your request.

The call to channel.setHeader(isoMsg_.pack()); is extremely suspicious, why would you send an ISO8583 message as a header to your actual ISO8583 message? This is probably wrong (unless required by the spec)

The logs on their end probably know why they are closing the connection and could give you a hint about what could be wrong.

I'm afraid you'll have to contact your remote endpoint.

apr
  • 1,288
  • 7
  • 8
  • Thanks for the advise @apr. I looked over the spec documentations and found out that they need the message sent over an SSL connection. I don't know how to go about that with JPOS – Sunday Okpokor Aug 19 '15 at 02:22
  • Take a look at https://github.com/jpos/jPOS/blob/master/doc/src/asciidoc/ch05/ssl_channels.adoc You can get the full document here: http://jpos.org/doc/proguide-draft.pdf – apr Nov 04 '15 at 15:37
0

The exception you receive is server-side, the server terminates client connection for many reasons like an invalid data package length, or like previous comment header not validate or different channel type you use (in case of JPOS)

Zero Code
  • 19
  • 1
  • 3