[jpos-users] Send And Receive The Data From One JPOS Server To Another JPOS

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jpos-users] Send And Receive The Data From One JPOS Server To Another JPOS

Karimullah Syed
Hi JPOS USERS,

I'm writing the JPOSTestClient to Send and Receive the Data From one JPOS Server To Another JPOS Server May be it use full.


public class JposClient {
public static void main(String[] args) throws IOException, ISOException {
byte[] tpduHeader = new byte[10];
tpduHeader = ISOUtil.str2bcd("6000000000",true);
ISO87BINNOPackager packager = new ISO87BINNOPackager();
BaseChannel channel = new NACChannel(packager, tpduHeader);
channel.setHost("192.168.1.177", 1980);
channel.connect();
System.out.println("Method: Inside process()" + "- channelConnected : " + channel.isConnected());
ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(packager);
isoMsg.setMTI("0200");
isoMsg.set(2, "011414533");
isoMsg.set(3, "000081");
isoMsg.set(11, "000002");
isoMsg.set(12, "114145");
isoMsg.set(13, "1229");
isoMsg.set(24, "999");
isoMsg.set(26, "05");
isoMsg.set(34, "0020879913");
isoMsg.set(41, "90000019");
isoMsg.set(63, "UNICDB803 - 2.1.0");
 byte msgbytes [] = isoMsg.pack();
          byte b [] = new byte[2];
          b[0] =0x00;
          b[1] = (byte) (isoMsg.pack().length + tpduHeader.length);
          byte [] header = addTwobyteArray(b, tpduHeader);
          byte [] data = addTwobyteArray(header, msgbytes);
          channel.getSocket().getOutputStream().write(data, 0, data.length);
ISOMsg responseIsoMsg = new ISOMsg();
responseIsoMsg.setPackager(packager);
responseIsoMsg = channel.receive();
System.out.println(responseIsoMsg);
channel.getSocket().close();
channel.disconnect();
}
public static byte[] addTwobyteArray(byte []array1,byte []array2) {
        byte[] result = new byte[array1.length + array2.length];
        for (int i = 0; i < array1.length; i++) {
            result[i] = array1[i];
        }
        for (int i = array1.length; i < result.length; i++) {
            result[i] = array2[i - array1.length];
        }
        return result;

    }
}


Thanks,
Karimullah Syed.

--
--
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/223df58f-09cc-4bfd-9c85-9e17c0352bca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [jpos-users] Send And Receive The Data From One JPOS Server To Another JPOS

Alejandro Revilla
Thank you for sharing, but your code actually doesn't include jPOS best practices. I suggest you take a look at the client simulator and server simulator code in jPOS-EE (http://jpos.org/doc/jPOS-EE.pdf) for a better example using Q2, and a multiplexer (QMUX).



--
--
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/CAAgSK%3D%3DZvJMrKQ1%3DZRAa39AsV_Xz6upGeLS8kYdOpfHqYGMnyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...