[jpos-users] Invalid message length

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jpos-users] Invalid message length

tony1


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

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/d08418f2-547a-47b3-9f8c-f82f78154aac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[jpos-users] Re: Invalid message length

tony1
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

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
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 | Threaded
Open this post in threaded view
|

Re: [jpos-users] Re: Invalid message length

Andrés Alcarraz
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

El 30 mar. 2017 6:35 AM, "Tony" <[hidden email]> escribió:
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

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAACHDe0hE4D42M3oDmX4%2B77qrPX_QOAPHatnY-qWOa-bsNvbqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.