[jpos-users] Not Able to Receive Request from Client Using CSChannel

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

[jpos-users] Not Able to Receive Request from Client Using CSChannel

Zachary Matu
Hi Frieinds,

I kindly need your help.. am not able to receive request from client.. The request-listener (ClientRequestListener) is not getting called..

 see my qbeans >>

server >>

<?xml version="1.0" ?>

<server class="org.jpos.q2.iso.QServer" logger="Q2"
  name="test-response-server">
 <attr name="port" type="java.lang.Integer">15000</attr>
 <channel name="test-response-channel" class="com.test.channels.TestChannel"
        logger="Q2" packager="com.test.packagers.TestPackager">
    
     <property name="keep-alive" value="true"></property>
 </channel>
 <request-listener class="com.test.listeners.ClientRequestListener" logger="Q2">
 
 </request-listener>
</server>

Packager

public class TestPackager extends ISOBasePackager {

    protected ISOFieldPackager[] fld = {
       /*000*/ new IFA_NUMERIC (  4, "MESSAGE TYPE INDICATOR"),
              /*001*/ new IFA_BITMAP  ( 16, "BIT MAP"),
              /*002*/ new IFA_LLNUM   ( 19, "PAN - PRIMARY ACCOUNT NUMBER"),
              /*003*/ new IFA_NUMERIC (  6, "PROCESSING CODE"),
              /*004*/ new IFA_NUMERIC ( 12, "AMOUNT, TRANSACTION"),
              /*005*/ new IFA_NUMERIC ( 12, "AMOUNT, SETTLEMENT"),
              /*006*/ new IFA_NUMERIC ( 12, "AMOUNT, CARDHOLDER BILLING"),
              /*007*/ new IFA_NUMERIC ( 10, "TRANSMISSION DATE AND TIME"),
              /*008*/ new IFA_NUMERIC (  8, "AMOUNT, CARDHOLDER BILLING FEE"),
              /*009*/ new IFA_NUMERIC (  8, "CONVERSION RATE, SETTLEMENT"),
              /*010*/ new IFA_NUMERIC (  8, "CONVERSION RATE, CARDHOLDER BILLING"),
              /*011*/ new IFA_NUMERIC (  6, "SYSTEM TRACE AUDIT NUMBER"),
              /*012*/ new IFA_NUMERIC (  14, "TIME, LOCAL TRANSACTION"),
              /*013*/ new IFA_NUMERIC (  4, "DATE, LOCAL TRANSACTION"),
              /*014*/ new IFA_NUMERIC (  4, "DATE, EXPIRATION"),
              /*015*/ new IFA_NUMERIC (  4, "DATE, SETTLEMENT"),
              /*016*/ new IFA_NUMERIC (  4, "DATE, CONVERSION"),
              /*017*/ new IFA_NUMERIC (  4, "DATE, CAPTURE"),
              /*018*/ new IFA_NUMERIC (  4, "MERCHANTS TYPE"),
              /*019*/ new IFA_NUMERIC (  3, "ACQUIRING INSTITUTION COUNTRY CODE"),
              /*020*/ new IFA_NUMERIC (  3, "PAN EXTENDED COUNTRY CODE"),
              /*021*/ new IFA_NUMERIC (  3, "FORWARDING INSTITUTION COUNTRY CODE"),
              /*022*/ new IFA_NUMERIC (  3, "POINT OF SERVICE ENTRY MODE"),
              /*023*/ new IFA_NUMERIC (  3, "CARD SEQUENCE NUMBER"),
              /*024*/ new IFA_NUMERIC (  3, "NETWORK INTERNATIONAL IDENTIFIEER"),
              /*025*/ new IFA_NUMERIC (  3, "POINT OF SERVICE CONDITION CODE"),
              /*026*/ new IFA_NUMERIC (  2, "POINT OF SERVICE PIN CAPTURE CODE"),
              /*027*/ new IFA_NUMERIC (  1, "AUTHORIZATION IDENTIFICATION RESP LEN"),
              /*028*/ new IFA_AMOUNT  (  9, "AMOUNT, TRANSACTION FEE"),
              /*029*/ new IFA_AMOUNT  (  9, "AMOUNT, SETTLEMENT FEE"),
              /*030*/ new IFA_AMOUNT  (  9, "AMOUNT, TRANSACTION PROCESSING FEE"),
              /*031*/ new IFA_AMOUNT  (  9, "AMOUNT, SETTLEMENT PROCESSING FEE"),
              /*032*/ new IFA_LLNUM   ( 11, "ACQUIRING INSTITUTION IDENT CODE"),
              /*033*/ new IFA_LLNUM   ( 11, "FORWARDING INSTITUTION IDENT CODE"),
              /*034*/ new IFA_LLCHAR  ( 28, "PAN EXTENDED"),
              /*035*/ new IFA_LLNUM   ( 38, "TRACK 2 DATA"),
              /*036*/ new IFA_LLLCHAR (104, "TRACK 3 DATA"),
              /*037*/ new IF_CHAR     ( 12, "RETRIEVAL REFERENCE NUMBER"),
              /*038*/ new IF_CHAR     (  6, "AUTHORIZATION IDENTIFICATION RESPONSE"),
              /*039*/ new IF_CHAR     (  3, "RESPONSE CODE"),
              /*040*/ new IF_CHAR     (  3, "SERVICE RESTRICTION CODE"),
              /*041*/ new IF_CHAR  ( 8, "CARD ACCEPTOR TERMINAL IDENTIFICACION"),
              /*042*/ new IF_CHAR     ( 15, "CARD ACCEPTOR IDENTIFICATION CODE" ),
              /*043*/ new IF_CHAR     ( 40, "CARD ACCEPTOR NAME/LOCATION"),
              /*044*/ new IF_CHAR     ( 2, "ADITIONAL RESPONSE DATA"),
              /*045*/ new IFA_LLCHAR  ( 76, "TRACK 1 DATA"),
              /*046*/ new IFA_LLLCHAR (999, "ADITIONAL DATA - ISO"),
              /*047*/ new IFA_LLLCHAR (999, "ADITIONAL DATA - NATIONAL"),
              /*048*/ new IFA_LLLLCHAR (9999, "ADITIONAL DATA - PRIVATE"),
              /*049*/ new IF_CHAR     (  3, "CURRENCY CODE, TRANSACTION"),
              /*050*/ new IF_CHAR     (  3, "CURRENCY CODE, SETTLEMENT"),
              /*051*/ new IF_CHAR     (  3, "CURRENCY CODE, CARDHOLDER BILLING"   ),
              /*052*/ new IF_CHAR     ( 16, "PIN DATA"   ),
              /*053*/ new IFA_NUMERIC ( 16, "SECURITY RELATED CONTROL INFORMATION"),
              /*054*/ new IFA_LLLCHAR (120, "ADDITIONAL AMOUNTS"),
              /*055*/ new IFA_LLLCHAR (999, "RESERVED ISO"),
              /*056*/ new IFA_LLLCHAR (999, "RESERVED ISO"),
              /*057*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL"),
              /*058*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL"),
              /*059*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL"),
              /*060*/ new IFA_LLLCHAR (999, "RESERVED PRIVATE"),
              /*061*/ new IF_CHAR     ( 14, "RESERVED PRIVATE"),
              /*062*/ new IFA_LLLCHAR (999, "RESERVED PRIVATE"),
              /*063*/ new IFA_LLLCHAR (999, "RESERVED PRIVATE"),
              /*064*/ new IFA_BINARY  ( 8, "MESSAGE AUTHENTICATION CODE FIELD"),
              /*065*/ new IFA_BINARY  (  1, "BITMAP, EXTENDED"),
              /*066*/ new IFA_NUMERIC (  1, "SETTLEMENT CODE"),
              /*067*/ new IFA_NUMERIC (  2, "EXTENDED PAYMENT CODE"),
              /*068*/ new IFA_NUMERIC (  3, "RECEIVING INSTITUTION COUNTRY CODE"),
              /*069*/ new IFA_NUMERIC (  3, "SETTLEMENT INSTITUTION COUNTRY CODE"),
              /*070*/ new IFA_NUMERIC (  3, "NETWORK MANAGEMENT INFORMATION CODE"),
              /*071*/ new IFA_NUMERIC (  4, "MESSAGE NUMBER"),
              /*072*/ new IFA_NUMERIC (  4, "MESSAGE NUMBER LAST"),
              /*073*/ new IFA_NUMERIC (  6, "DATE ACTION"),
              /*074*/ new IFA_NUMERIC ( 10, "CREDITS NUMBER"),
              /*075*/ new IFA_NUMERIC ( 10, "CREDITS REVERSAL NUMBER"),
              /*076*/ new IFA_NUMERIC ( 10, "DEBITS NUMBER"),
              /*077*/ new IFA_NUMERIC ( 10, "DEBITS REVERSAL NUMBER"),
              /*078*/ new IFA_NUMERIC ( 10, "TRANSFER NUMBER"),
              /*079*/ new IFA_NUMERIC ( 10, "TRANSFER REVERSAL NUMBER"),
              /*080*/ new IFA_NUMERIC ( 10, "INQUIRIES NUMBER"),
              /*081*/ new IFA_NUMERIC ( 10, "AUTHORIZATION NUMBER"),
              /*082*/ new IFA_NUMERIC ( 12, "CREDITS, PROCESSING FEE AMOUNT"),
              /*083*/ new IFA_NUMERIC ( 12, "CREDITS, TRANSACTION FEE AMOUNT"),
             /*084*/ new IFA_NUMERIC ( 12, "DEBITS, PROCESSING FEE AMOUNT"),
             /*085*/ new IFA_NUMERIC ( 12, "DEBITS, TRANSACTION FEE AMOUNT"),
             /*086*/ new IFA_NUMERIC ( 16, "CREDITS, AMOUNT"),
             /*087*/ new IFA_NUMERIC ( 16, "CREDITS, REVERSAL AMOUNT"),
             /*088*/ new IFA_NUMERIC ( 16, "DEBITS, AMOUNT"),
             /*089*/ new IFA_NUMERIC ( 16, "DEBITS, REVERSAL AMOUNT"),
             /*090*/ new IFA_NUMERIC ( 42, "ORIGINAL DATA ELEMENTS"),
             /*091*/ new IF_CHAR     (  1, "FILE UPDATE CODE"),
             /*092*/ new IF_CHAR     (  2, "FILE SECURITY CODE"),
             /*093*/ new IF_CHAR     (  6, "RESPONSE INDICATOR"),
             /*094*/ new IF_CHAR     (  7, "SERVICE INDICATOR"),
             /*095*/ new IF_CHAR     ( 42, "REPLACEMENT AMOUNTS"),
             /*096*/ new IFA_BINARY  ( 16, "MESSAGE SECURITY CODE"),
             /*097*/ new IFA_AMOUNT  ( 17, "AMOUNT, NET SETTLEMENT"),
             /*098*/ new IF_CHAR     ( 25, "PAYEE"),
             /*099*/ new IFA_LLNUM   ( 11, "SETTLEMENT INSTITUTION IDENT CODE"),
             /*100*/ new IFA_LLNUM   ( 11, "RECEIVING INSTITUTION IDENT CODE"),
             /*101*/ new IFA_LLCHAR  ( 17, "FILE NAME"),
             /*102*/ new IFA_LLCHAR  ( 28, "ACCOUNT IDENTIFICATION 1"),
             /*103*/ new IFA_LLCHAR  ( 28, "ACCOUNT IDENTIFICATION 2"),
             /*104*/ new IFA_LLLCHAR (100, "TRANSACTION DESCRIPTION"),
             /*105*/ new IFA_NUMERIC ( 25, "RESERVED ISO USE"),
             /*106*/ new IFA_NUMERIC ( 46, "RESERVED ISO USE"),
             /*107*/ new IFA_LLLCHAR (999, "RESERVED ISO USE"),
             /*108*/ new IFA_LLLCHAR (999, "RESERVED ISO USE"),
             /*109*/ new IFA_LLLCHAR (999, "RESERVED ISO USE"),
             /*110*/ new IFA_LLLCHAR (999, "RESERVED ISO USE"),
             /*111*/ new IFA_LLLCHAR (999, "RESERVED ISO USE"),
             /*112*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*113*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*114*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"   ),
             /*115*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*116*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"  ),
             /*117*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*118*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*119*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*120*/ new IFA_LLLCHAR (999, "RESERVED PRIVATE USE"),
            /*121*/ new IFA_LLLCHAR (23, "S-121 BASE24-POS AUTH INDICATORS"),
             ///*121*/ new IFA_LLLCHAR (47, "S-121 BASE24-POS AUTH INDICATORS"),
             /*122*/ new IFA_LLLNUM  (14, "S-122 CARD ISSUER IDENTIFICATION CODE"),
             /*123*/ new IFA_LLLCHAR (999, "S-123 CRYPTOGRAFIC SERVICE MESSAGE"),
             /*124*/ new IFA_LLLCHAR (17, "S-124 DEPOSIT TYPE OR BATCH/SHIFT DATA"),
             ///*124*/ new IFA_LLLCHAR (12, "S-124 DEPOSIT TYPE OR BATCH/SHIFT DATA"),
             /*125*/ new IFA_LLLCHAR (15, "S-125 ATM ACCT INDICATOR OR POS SETTLEMENT DATA"),
             /*126*/ new IFA_LLLCHAR (999, "S-126 ATM ADDIC. DATA OR POS PRE-AUTH/CHARGEBACK"),
             /*127*/ new IFA_LLCHAR (99, "BASE24-POS User Data"),
             /*128*/ new IFA_NUMERIC (16, "MAC 2")
      
    };

    public TestPackager() {
        super();
        setFieldPackager(fld);
    }


My channel
public class TestChannel extends CSChannel {

    @Override
    protected void sendMessageLength(int len) throws IOException {
        if (len > 9999)
            throw new IOException ("len exceeded");
        else if (len < 0)
            throw new IOException ("invalid length");
        System.out.println("Message length >> " + len);
        serverOut.write(ISOUtil.zeropad(len, 6).getBytes());
        System.out.println("Message length >> " + new String(ISOUtil.zeropad(len, 6).getBytes()));
    }

    @Override
    protected int getMessageLength() throws IOException, ISOException {
     int l = 0;
        byte[] b = new byte[4];
        while (l == 0) {
            serverIn.readFully(b,0,4);
            try {
                if ((l=Integer.parseInt(new String(b))) == 0) {
                    serverOut.write(b);
                    serverOut.flush();
                }
            } catch (NumberFormatException e) {
                throw new ISOException ("Invalid message length "+new String(b));
            }
        }
    return l;
    }


request listener


public class ClientRequestListener implements ISORequestListener, Configurable {

    Log log;
    private Space<String, ISOMsg> sp;

    @Override
    public boolean process(ISOSource isoSrc, ISOMsg isoMsg) {
        ISOMsg reply = (ISOMsg) isoMsg.clone();
        try {
            System.out.println("At client request listener...");
         
            sp.out(isoMsg.getString(39), isoMsg);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

    @Override
    public void setConfiguration(Configuration c) throws ConfigurationException {
       sp = SpaceFactory.getSpace(c.get("space"));
    }
   
    public ClientRequestListener() {
        super();
    }

}


Am able to send using MUX and channel adaptor but not able to receive response.. where could i be going wrong.. ?

Ive also tried to run a simple request from main as shown below.. but not able to get response...
..
 public static void main(String[] args) {
        try {
 TestChannel channel = new TestChannel();
            channel.setPackager(new TestPackager());
            channel.setHost("localhost");
            channel.setPort(15000);
            // channel.setHeader("ISO06000005");
            ((LogSource) channel).setLogger(logger, "test-channel");
            channel.connect();
            ISOUtil.sleep(5000);
            ISOMsg m = createSignOnReqMsg();

        
            channel.send(m);
        ISOMsg r = channel.receive();
}

 public static ISOMsg createSignOnReqMsg() {
        int stan = new Random().nextInt(900000);
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
      
    
        ISOMsg echoLogin;

        echoLogin = new ISOMsg("1804");
      
        try {
        
            echoLogin.set(12, dateFormat.format(new Date()));
            echoLogin.set(11, stan + "");
            echoLogin.set(24, "801");
            echoLogin.setPackager(new TestPackager());
//            echoLogin.pack();
            //System.out.println("iso header >> " + echoLogin.get);

        } catch (Exception e) {
            e.printStackTrace();
          
        }
        return echoLogin;
    }

Out put >>

<log realm="test-channel/127.0.0.1:15000" at="Mon Mar 06 14:43:00.677 EAT 2017" lifespan="2ms">
  <send>
    <isomsg direction="outgoing">
      <!-- com.nbkkits.packagers.KitsPackager -->
      <field id="0" value="1804"/>
      <field id="11" value="54047"/>
      <field id="12" value="20170306144300"/>
      <field id="24" value="801"/>
    </isomsg>
  </send>
</log>

Thanks in advance



--
--
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/92463791-8f56-4f70-b5d4-dcccd27db1fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jpos-users] Re: Not Able to Receive Request from Client Using CSChannel

Alejandro Revilla
It seems that your request listener is trying to get instantiate a Space using a "space" property that doesn't seem to be present in your XML.

I suggest you use "Space sp = SpaceFactory.getSpace()" (no parameters) just to verify this is the problem.



--
--
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/6d8165d1-7dda-4747-bb26-222407aad14f%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] Not Able to Receive Request from Client Using CSChannel

Andrés Alcarraz
In reply to this post by Zachary Matu
I think your problem is you are sending a length of 6 digits and expect to receive a length of 4.
serverOut.write(ISOUtil.zeropad(len, 6).getBytes());


Andrés Alcarraz

Enviado desde el móvil

El 6 mar. 2017 9:04 AM, "Zachary Matu" <[hidden email]> escribió:
Hi Frieinds,

I kindly need your help.. am not able to receive request from client.. The request-listener (ClientRequestListener) is not getting called..

 see my qbeans >>

server >>

<?xml version="1.0" ?>

<server class="org.jpos.q2.iso.QServer" logger="Q2"
  name="test-response-server">
 <attr name="port" type="java.lang.Integer">15000</attr>
 <channel name="test-response-channel" class="com.test.channels.TestChannel"
        logger="Q2" packager="com.test.packagers.TestPackager">
    
     <property name="keep-alive" value="true"></property>
 </channel>
 <request-listener class="com.test.listeners.ClientRequestListener" logger="Q2">
 
 </request-listener>
</server>

Packager

public class TestPackager extends ISOBasePackager {

    protected ISOFieldPackager[] fld = {
       /*000*/ new IFA_NUMERIC (  4, "MESSAGE TYPE INDICATOR"),
              /*001*/ new IFA_BITMAP  ( 16, "BIT MAP"),
              /*002*/ new IFA_LLNUM   ( 19, "PAN - PRIMARY ACCOUNT NUMBER"),
              /*003*/ new IFA_NUMERIC (  6, "PROCESSING CODE"),
              /*004*/ new IFA_NUMERIC ( 12, "AMOUNT, TRANSACTION"),
              /*005*/ new IFA_NUMERIC ( 12, "AMOUNT, SETTLEMENT"),
              /*006*/ new IFA_NUMERIC ( 12, "AMOUNT, CARDHOLDER BILLING"),
              /*007*/ new IFA_NUMERIC ( 10, "TRANSMISSION DATE AND TIME"),
              /*008*/ new IFA_NUMERIC (  8, "AMOUNT, CARDHOLDER BILLING FEE"),
              /*009*/ new IFA_NUMERIC (  8, "CONVERSION RATE, SETTLEMENT"),
              /*010*/ new IFA_NUMERIC (  8, "CONVERSION RATE, CARDHOLDER BILLING"),
              /*011*/ new IFA_NUMERIC (  6, "SYSTEM TRACE AUDIT NUMBER"),
              /*012*/ new IFA_NUMERIC (  14, "TIME, LOCAL TRANSACTION"),
              /*013*/ new IFA_NUMERIC (  4, "DATE, LOCAL TRANSACTION"),
              /*014*/ new IFA_NUMERIC (  4, "DATE, EXPIRATION"),
              /*015*/ new IFA_NUMERIC (  4, "DATE, SETTLEMENT"),
              /*016*/ new IFA_NUMERIC (  4, "DATE, CONVERSION"),
              /*017*/ new IFA_NUMERIC (  4, "DATE, CAPTURE"),
              /*018*/ new IFA_NUMERIC (  4, "MERCHANTS TYPE"),
              /*019*/ new IFA_NUMERIC (  3, "ACQUIRING INSTITUTION COUNTRY CODE"),
              /*020*/ new IFA_NUMERIC (  3, "PAN EXTENDED COUNTRY CODE"),
              /*021*/ new IFA_NUMERIC (  3, "FORWARDING INSTITUTION COUNTRY CODE"),
              /*022*/ new IFA_NUMERIC (  3, "POINT OF SERVICE ENTRY MODE"),
              /*023*/ new IFA_NUMERIC (  3, "CARD SEQUENCE NUMBER"),
              /*024*/ new IFA_NUMERIC (  3, "NETWORK INTERNATIONAL IDENTIFIEER"),
              /*025*/ new IFA_NUMERIC (  3, "POINT OF SERVICE CONDITION CODE"),
              /*026*/ new IFA_NUMERIC (  2, "POINT OF SERVICE PIN CAPTURE CODE"),
              /*027*/ new IFA_NUMERIC (  1, "AUTHORIZATION IDENTIFICATION RESP LEN"),
              /*028*/ new IFA_AMOUNT  (  9, "AMOUNT, TRANSACTION FEE"),
              /*029*/ new IFA_AMOUNT  (  9, "AMOUNT, SETTLEMENT FEE"),
              /*030*/ new IFA_AMOUNT  (  9, "AMOUNT, TRANSACTION PROCESSING FEE"),
              /*031*/ new IFA_AMOUNT  (  9, "AMOUNT, SETTLEMENT PROCESSING FEE"),
              /*032*/ new IFA_LLNUM   ( 11, "ACQUIRING INSTITUTION IDENT CODE"),
              /*033*/ new IFA_LLNUM   ( 11, "FORWARDING INSTITUTION IDENT CODE"),
              /*034*/ new IFA_LLCHAR  ( 28, "PAN EXTENDED"),
              /*035*/ new IFA_LLNUM   ( 38, "TRACK 2 DATA"),
              /*036*/ new IFA_LLLCHAR (104, "TRACK 3 DATA"),
              /*037*/ new IF_CHAR     ( 12, "RETRIEVAL REFERENCE NUMBER"),
              /*038*/ new IF_CHAR     (  6, "AUTHORIZATION IDENTIFICATION RESPONSE"),
              /*039*/ new IF_CHAR     (  3, "RESPONSE CODE"),
              /*040*/ new IF_CHAR     (  3, "SERVICE RESTRICTION CODE"),
              /*041*/ new IF_CHAR  ( 8, "CARD ACCEPTOR TERMINAL IDENTIFICACION"),
              /*042*/ new IF_CHAR     ( 15, "CARD ACCEPTOR IDENTIFICATION CODE" ),
              /*043*/ new IF_CHAR     ( 40, "CARD ACCEPTOR NAME/LOCATION"),
              /*044*/ new IF_CHAR     ( 2, "ADITIONAL RESPONSE DATA"),
              /*045*/ new IFA_LLCHAR  ( 76, "TRACK 1 DATA"),
              /*046*/ new IFA_LLLCHAR (999, "ADITIONAL DATA - ISO"),
              /*047*/ new IFA_LLLCHAR (999, "ADITIONAL DATA - NATIONAL"),
              /*048*/ new IFA_LLLLCHAR (9999, "ADITIONAL DATA - PRIVATE"),
              /*049*/ new IF_CHAR     (  3, "CURRENCY CODE, TRANSACTION"),
              /*050*/ new IF_CHAR     (  3, "CURRENCY CODE, SETTLEMENT"),
              /*051*/ new IF_CHAR     (  3, "CURRENCY CODE, CARDHOLDER BILLING"   ),
              /*052*/ new IF_CHAR     ( 16, "PIN DATA"   ),
              /*053*/ new IFA_NUMERIC ( 16, "SECURITY RELATED CONTROL INFORMATION"),
              /*054*/ new IFA_LLLCHAR (120, "ADDITIONAL AMOUNTS"),
              /*055*/ new IFA_LLLCHAR (999, "RESERVED ISO"),
              /*056*/ new IFA_LLLCHAR (999, "RESERVED ISO"),
              /*057*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL"),
              /*058*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL"),
              /*059*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL"),
              /*060*/ new IFA_LLLCHAR (999, "RESERVED PRIVATE"),
              /*061*/ new IF_CHAR     ( 14, "RESERVED PRIVATE"),
              /*062*/ new IFA_LLLCHAR (999, "RESERVED PRIVATE"),
              /*063*/ new IFA_LLLCHAR (999, "RESERVED PRIVATE"),
              /*064*/ new IFA_BINARY  ( 8, "MESSAGE AUTHENTICATION CODE FIELD"),
              /*065*/ new IFA_BINARY  (  1, "BITMAP, EXTENDED"),
              /*066*/ new IFA_NUMERIC (  1, "SETTLEMENT CODE"),
              /*067*/ new IFA_NUMERIC (  2, "EXTENDED PAYMENT CODE"),
              /*068*/ new IFA_NUMERIC (  3, "RECEIVING INSTITUTION COUNTRY CODE"),
              /*069*/ new IFA_NUMERIC (  3, "SETTLEMENT INSTITUTION COUNTRY CODE"),
              /*070*/ new IFA_NUMERIC (  3, "NETWORK MANAGEMENT INFORMATION CODE"),
              /*071*/ new IFA_NUMERIC (  4, "MESSAGE NUMBER"),
              /*072*/ new IFA_NUMERIC (  4, "MESSAGE NUMBER LAST"),
              /*073*/ new IFA_NUMERIC (  6, "DATE ACTION"),
              /*074*/ new IFA_NUMERIC ( 10, "CREDITS NUMBER"),
              /*075*/ new IFA_NUMERIC ( 10, "CREDITS REVERSAL NUMBER"),
              /*076*/ new IFA_NUMERIC ( 10, "DEBITS NUMBER"),
              /*077*/ new IFA_NUMERIC ( 10, "DEBITS REVERSAL NUMBER"),
              /*078*/ new IFA_NUMERIC ( 10, "TRANSFER NUMBER"),
              /*079*/ new IFA_NUMERIC ( 10, "TRANSFER REVERSAL NUMBER"),
              /*080*/ new IFA_NUMERIC ( 10, "INQUIRIES NUMBER"),
              /*081*/ new IFA_NUMERIC ( 10, "AUTHORIZATION NUMBER"),
              /*082*/ new IFA_NUMERIC ( 12, "CREDITS, PROCESSING FEE AMOUNT"),
              /*083*/ new IFA_NUMERIC ( 12, "CREDITS, TRANSACTION FEE AMOUNT"),
             /*084*/ new IFA_NUMERIC ( 12, "DEBITS, PROCESSING FEE AMOUNT"),
             /*085*/ new IFA_NUMERIC ( 12, "DEBITS, TRANSACTION FEE AMOUNT"),
             /*086*/ new IFA_NUMERIC ( 16, "CREDITS, AMOUNT"),
             /*087*/ new IFA_NUMERIC ( 16, "CREDITS, REVERSAL AMOUNT"),
             /*088*/ new IFA_NUMERIC ( 16, "DEBITS, AMOUNT"),
             /*089*/ new IFA_NUMERIC ( 16, "DEBITS, REVERSAL AMOUNT"),
             /*090*/ new IFA_NUMERIC ( 42, "ORIGINAL DATA ELEMENTS"),
             /*091*/ new IF_CHAR     (  1, "FILE UPDATE CODE"),
             /*092*/ new IF_CHAR     (  2, "FILE SECURITY CODE"),
             /*093*/ new IF_CHAR     (  6, "RESPONSE INDICATOR"),
             /*094*/ new IF_CHAR     (  7, "SERVICE INDICATOR"),
             /*095*/ new IF_CHAR     ( 42, "REPLACEMENT AMOUNTS"),
             /*096*/ new IFA_BINARY  ( 16, "MESSAGE SECURITY CODE"),
             /*097*/ new IFA_AMOUNT  ( 17, "AMOUNT, NET SETTLEMENT"),
             /*098*/ new IF_CHAR     ( 25, "PAYEE"),
             /*099*/ new IFA_LLNUM   ( 11, "SETTLEMENT INSTITUTION IDENT CODE"),
             /*100*/ new IFA_LLNUM   ( 11, "RECEIVING INSTITUTION IDENT CODE"),
             /*101*/ new IFA_LLCHAR  ( 17, "FILE NAME"),
             /*102*/ new IFA_LLCHAR  ( 28, "ACCOUNT IDENTIFICATION 1"),
             /*103*/ new IFA_LLCHAR  ( 28, "ACCOUNT IDENTIFICATION 2"),
             /*104*/ new IFA_LLLCHAR (100, "TRANSACTION DESCRIPTION"),
             /*105*/ new IFA_NUMERIC ( 25, "RESERVED ISO USE"),
             /*106*/ new IFA_NUMERIC ( 46, "RESERVED ISO USE"),
             /*107*/ new IFA_LLLCHAR (999, "RESERVED ISO USE"),
             /*108*/ new IFA_LLLCHAR (999, "RESERVED ISO USE"),
             /*109*/ new IFA_LLLCHAR (999, "RESERVED ISO USE"),
             /*110*/ new IFA_LLLCHAR (999, "RESERVED ISO USE"),
             /*111*/ new IFA_LLLCHAR (999, "RESERVED ISO USE"),
             /*112*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*113*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*114*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"   ),
             /*115*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*116*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"  ),
             /*117*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*118*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*119*/ new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),
             /*120*/ new IFA_LLLCHAR (999, "RESERVED PRIVATE USE"),
            /*121*/ new IFA_LLLCHAR (23, "S-121 BASE24-POS AUTH INDICATORS"),
             ///*121*/ new IFA_LLLCHAR (47, "S-121 BASE24-POS AUTH INDICATORS"),
             /*122*/ new IFA_LLLNUM  (14, "S-122 CARD ISSUER IDENTIFICATION CODE"),
             /*123*/ new IFA_LLLCHAR (999, "S-123 CRYPTOGRAFIC SERVICE MESSAGE"),
             /*124*/ new IFA_LLLCHAR (17, "S-124 DEPOSIT TYPE OR BATCH/SHIFT DATA"),
             ///*124*/ new IFA_LLLCHAR (12, "S-124 DEPOSIT TYPE OR BATCH/SHIFT DATA"),
             /*125*/ new IFA_LLLCHAR (15, "S-125 ATM ACCT INDICATOR OR POS SETTLEMENT DATA"),
             /*126*/ new IFA_LLLCHAR (999, "S-126 ATM ADDIC. DATA OR POS PRE-AUTH/CHARGEBACK"),
             /*127*/ new IFA_LLCHAR (99, "BASE24-POS User Data"),
             /*128*/ new IFA_NUMERIC (16, "MAC 2")
      
    };

    public TestPackager() {
        super();
        setFieldPackager(fld);
    }


My channel
public class TestChannel extends CSChannel {

    @Override
    protected void sendMessageLength(int len) throws IOException {
        if (len > 9999)
            throw new IOException ("len exceeded");
        else if (len < 0)
            throw new IOException ("invalid length");
        System.out.println("Message length >> " + len);
        serverOut.write(ISOUtil.zeropad(len, 6).getBytes());
        System.out.println("Message length >> " + new String(ISOUtil.zeropad(len, 6).getBytes()));
    }

    @Override
    protected int getMessageLength() throws IOException, ISOException {
     int l = 0;
        byte[] b = new byte[4];
        while (l == 0) {
            serverIn.readFully(b,0,4);
            try {
                if ((l=Integer.parseInt(new String(b))) == 0) {
                    serverOut.write(b);
                    serverOut.flush();
                }
            } catch (NumberFormatException e) {
                throw new ISOException ("Invalid message length "+new String(b));
            }
        }
    return l;
    }


request listener


public class ClientRequestListener implements ISORequestListener, Configurable {

    Log log;
    private Space<String, ISOMsg> sp;

    @Override
    public boolean process(ISOSource isoSrc, ISOMsg isoMsg) {
        ISOMsg reply = (ISOMsg) isoMsg.clone();
        try {
            System.out.println("At client request listener...");
         
            sp.out(isoMsg.getString(39), isoMsg);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

    @Override
    public void setConfiguration(Configuration c) throws ConfigurationException {
       sp = SpaceFactory.getSpace(c.get("space"));
    }
   
    public ClientRequestListener() {
        super();
    }

}


Am able to send using MUX and channel adaptor but not able to receive response.. where could i be going wrong.. ?

Ive also tried to run a simple request from main as shown below.. but not able to get response...
..
 public static void main(String[] args) {
        try {
 TestChannel channel = new TestChannel();
            channel.setPackager(new TestPackager());
            channel.setHost("localhost");
            channel.setPort(15000);
            // channel.setHeader("ISO06000005");
            ((LogSource) channel).setLogger(logger, "test-channel");
            channel.connect();
            ISOUtil.sleep(5000);
            ISOMsg m = createSignOnReqMsg();

        
            channel.send(m);
        ISOMsg r = channel.receive();
}

 public static ISOMsg createSignOnReqMsg() {
        int stan = new Random().nextInt(900000);
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
      
    
        ISOMsg echoLogin;

        echoLogin = new ISOMsg("1804");
      
        try {
        
            echoLogin.set(12, dateFormat.format(new Date()));
            echoLogin.set(11, stan + "");
            echoLogin.set(24, "801");
            echoLogin.setPackager(new TestPackager());
//            echoLogin.pack();
            //System.out.println("iso header >> " + echoLogin.get);

        } catch (Exception e) {
            e.printStackTrace();
          
        }
        return echoLogin;
    }

Out put >>

<log realm="test-channel/127.0.0.1:15000" at="Mon Mar 06 14:43:00.677 EAT 2017" lifespan="2ms">
  <send>
    <isomsg direction="outgoing">
      <!-- com.nbkkits.packagers.KitsPackager -->
      <field id="0" value="1804"/>
      <field id="11" value="54047"/>
      <field id="12" value="20170306144300"/>
      <field id="24" value="801"/>
    </isomsg>
  </send>
</log>

Thanks in advance



--
--
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/92463791-8f56-4f70-b5d4-dcccd27db1fd%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/CAACHDe3Y4f1Om2bp7mw%2BaMGt-8PEcgD2DPM14N3KcNU--t4x6w%40mail.gmail.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] Not Able to Receive Request from Client Using CSChannel

Zachary Matu
Thanks Alejandro, Andres fot your response..

Indeed getMessageLength() was the problem..wad reading 4 instead of 6 digits..  solved it!

--
--
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/ac1d1e8e-2fd6-4259-99c4-39940af116bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...