Invalid message length

40 views
Skip to first unread message

Tony

unread,
Mar 30, 2017, 5:28:23 AM3/30/17
to jPOS Users


I sending these data to server

public class Test {
   
   
public static void main(String args[]) throws ISOException
   
{
     
Logger logger = new Logger();
        logger
.addListener(new SimpleLogListener(System.out));
       
ISOMsg m = new ISOMsg();
       
MEPSISOHeader header = new MEPSISOHeader(ISOUtil.hex2byte("303030303030303030303030303030303030303030303030303030"));
       
//MEPSISOHeader header = new MEPSISOHeader();
       
System.out.println("ori: " + ISOUtil.dumpString(header.pack()));
        header
.setLiteral(MEPSISOHeader.LETERAL);
        header
.setProductIndicator(MEPSISOHeader.PROD_IND_MEPS_POS);
                                     
......
        m
.setHeader(header);
        header
.dump("");
        m
.setMTI("0800");
        m
.set(7, "xxxxxxxxxx");
     
.                 ......

       
MEPSChannel channel = new MEPSChannel("localhost", 7010, new ISO87APackager(), header);
       
((LogSource) channel).setLogger(logger, "channel");
       
try {
            channel
.connect();

            channel
.send(m);
           
ISOMsg incoming = channel.receive();

       
} catch (Exception e) {
           
System.out.println(e);
       
}
   
}
}




And here the server side

public class ServerTest implements ISORequestListener{
   
   
public static void main(String[] args)
   
{
       
ServerChannel sChannel = null;
       
Logger logger = new Logger();
        logger
.addListener(new SimpleLogListener(System.out));
       
try{
         sChannel
= new ASCIIChannel(new ISO87APackager());
       
((LogSource)sChannel).setLogger(logger,"server-channel-logger");
       
}catch(Exception e){
           
System.out.println(e);
       
}
       
ISOServer isoServer = new ISOServer(7010,sChannel,null); ISORequestListeners
        isoServer
.setLogger(logger,"server-logger");
       
        isoServer
.addISORequestListener(new ServerTest());
       
new Thread(isoServer).start(); // able to accept multiple connections at the same time
   
}
   
     
@Override
   
public boolean process(ISOSource isoSource, ISOMsg isoMsg) {

       
ISOMsg m = (ISOMsg) isoMsg.clone();
       
try {
            m
.setResponseMTI();
            m
.set(7,"xxxxxxxxxx");
                     
......
            isoSource
.send(m);
       
} catch (ISOException e) {
       
} catch (IOException e) {
       
}

       
return true;
   
}
}




I can send the message, but cannot receive. Here the error found in the server

<log realm="server-channel-logger/127.0.0.1:43094" at="Thu Mar 30 17:14:53.995 MYT 2017" lifespan="505ms">
 
<receive>
   
<iso-exception>
      Invalid message length

Tony

unread,
Mar 30, 2017, 5:35:02 AM3/30/17
to jPOS Users
Error in channel side

java.io.EOFException



Error in server

<log realm="server-logger.session/127.0.0.1:43166" at="Thu Mar 30 17:31:59.496 MYT 2017">
  <session-error>
    <iso-exception>
      Invalid message length

Andrés Alcarraz

unread,
Mar 30, 2017, 9:39:45 AM3/30/17
to jPOS Users
You have a different channel in the server than in the client, if your Client channel is sending the length differently than the ASCIIchannel is expecting you will have exactly that behavior.

As you didn't post your Client channel code I'm afraid that we can't give you more help.

Also in the client you are sending a header that your server channel isn't expecting.


Andrés Alcarraz

Enviado desde el móvil

--
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/7439487f-fc51-4f18-b9c7-76266dfe8fc9%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages