[jpos-users] Add header above the field in JPOS

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

[jpos-users] Add header above the field in JPOS

tony1


I still new to JPOS and need to have a results as below, where there have  a `<header></header>` before the `<field>`

    <log realm="server-channel-logger/127.0.0.1:34428" at="Tue Mar 28 15:11:33.377 MYT 2017" lifespan="569ms">
     
<receive>
       
<isomsg direction="incoming">
         
<header>
           
<field id="literal" value="ISO"/>
           
<field id = "proind" value ="00" />
           
<field id = "relNum" value ="xx" />
                        .....
         
</header>
         
<field id="0" value="0800"/>
         
<field id="7" value="03xxxxxxxx"/>
         
<field id="11" value="xxxxxx"/>
                        .......
       
</isomsg>
     
</receive>
   
</log>
   


This is what I have tried in Channel side

    public static void main(String[] args) throws Exception {
           
Logger logger = new Logger();
            logger
.addListener(new SimpleLogListener(System.out));
           
ISOChannel channel = new ASCIIChannel("localhost", 8000, new ISO87APackager());
           
((LogSource) channel).setLogger(logger, "test-channel");
           
try {
                channel
.connect();
               
ISOMsg m = new ISOMsg();
               
MEPSISOHeader header = new MEPSISOHeader(ISOUtil.hex2byte("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"));
                header
.setLiteral(MEPSISOHeader.LETERAL);
                header
.setProductIndicator(MEPSISOHeader.PROD_IND_MEPS_POS);
                header
.setReleaseNumber(MEPSISOHeader.RELEASE_NUMBER_E_POS_MSG);
                           
........
             
                header
.dump ("");
                m
.setMTI("0800");
                m
.set(7, "03xxxxxxxx");
                m
.set(11, "xxxxxx");
                     
....
                channel
.send(m);
               
ISOMsg incoming = channel.receive();
               
System.out.println(incoming.pack());
           
} catch (Exception e) {
               
System.out.println(e);
           
}
       
}



And this is the dump function

       
@Override
           
public void dump (String indent) {
               
if (header != null) {
                   
System.out.println (
                        indent
                     
+ "<header>\n"
                     
+ indent + " <field id=\"literal\" value=\""+ new String (header, 0, 3) + "\"/>\n"
                     
+ indent + " <field id=\"proInd\" value=\""+ new String(header, 3, 2) + "\"/>\n"
                     
+ indent + " <field id=\"relNum\" value=\""+ new String(header, 5, 2) + "\"/>\n"
                     
+ indent + "</header>"
                   
);  
               
}  
           
}



My result

     
 </connect>
   
</log>
   
<header>
     
<field id="literal" value="ISO"/>
     
<field id="proInd" value="00"/>
          .....
   
</header>
   
<log realm="test-channel/127.0.0.1:8000" at="Tue Mar 28 15:45:48.991 MYT 2017" lifespan="2ms">
     
<send>
       
<isomsg direction="outgoing">
         
<!-- org.jpos.iso.packager.ISO87APackager -->
         
<field id="0" value="0800"/>
         
<field id="7" value="03xxxxxxxx"/>
         
<field id="11" value="xxxxxx"/>
                  .....
       
</isomsg>
     
</send>
   
</log>
   
     


Is there a way I can move the `<log realm ...>` above the header ? I want the header part to be sent to the server too.

--
--
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/c4fe50ec-eacf-4794-aa8f-30be3bbb5fa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[jpos-users] Re: Add header above the field in JPOS

tony1
Anyone can help ? Thanks

--
--
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/6251cf52-9762-40dc-8b7d-c0c87baebc95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Re: Add header above the field in JPOS

Andrés Alcarraz
Your are never setting the header to the channel nor the message. you have to perform m.setHeader(header) before sending the message.

Although the header will be printed using its  dump method only if it's class implements the Loggeable interface.

hope this helps, 

best regards

Andrés

Andrés Alcarraz

2017-03-28 6:57 GMT-03:00 Tony <[hidden email]>:
Anyone can help ? Thanks

--
--
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/6251cf52-9762-40dc-8b7d-c0c87baebc95%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/CAACHDe2vtQg3Ng8gkcyg_38V27tWEDqQ4DwN402nmbLWGkkeUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Re: Add header above the field in JPOS

tony1
If I perform m.setHeader(header), I will not getting ISOxxxxxxx


在 2017年3月29日星期三 UTC+8上午2:32:46,Andrés Alcarraz写道:
Your are never setting the header to the channel nor the message. you have to perform m.setHeader(header) before sending the message.

Although the header will be printed using its  dump method only if it's class implements the Loggeable interface.

hope this helps, 

best regards

Andrés

Andrés Alcarraz

2017-03-28 6:57 GMT-03:00 Tony <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="CuqRFCwqAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">nick_s...@...>:
Anyone can help ? Thanks

--
--
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: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="CuqRFCwqAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">sa...@...
---
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="CuqRFCwqAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jpos-users+...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="CuqRFCwqAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jpos-...@....
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jpos-users/6251cf52-9762-40dc-8b7d-c0c87baebc95%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jpos-users/6251cf52-9762-40dc-8b7d-c0c87baebc95%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jpos-users/6251cf52-9762-40dc-8b7d-c0c87baebc95%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jpos-users/6251cf52-9762-40dc-8b7d-c0c87baebc95%40googlegroups.com.

For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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/d8d43537-fe18-4b85-9704-e694189b2ef1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Re: Add header above the field in JPOS

Andrés Alcarraz
If you don't want to send that header I fail to understand what are you trying to achieve

Andrés Alcarraz

Enviado desde el móvil

El 28 mar. 2017 10:10 PM, "Tony" <[hidden email]> escribió:
If I perform m.setHeader(header), I will not getting ISOxxxxxxx


在 2017年3月29日星期三 UTC+8上午2:32:46,Andrés Alcarraz写道:
Your are never setting the header to the channel nor the message. you have to perform m.setHeader(header) before sending the message.

Although the header will be printed using its  dump method only if it's class implements the Loggeable interface.

hope this helps, 

best regards

Andrés

Andrés Alcarraz

2017-03-28 6:57 GMT-03:00 Tony <[hidden email]>:
Anyone can help ? Thanks

--
--
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 jpos-users+...@googlegroups.com.
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/6251cf52-9762-40dc-8b7d-c0c87baebc95%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/d8d43537-fe18-4b85-9704-e694189b2ef1%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/CAACHDe0o%2BY%2BYk-ALFVAhg-s6hN6N7J7DYzSd2nUdPMYaT%2BkMPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

OT Re: [jpos-users] Add header above the field in JPOS

jPOS - Users mailing list
In reply to this post by tony1
On 28/03/17 10:33, Tony wrote:
>
>   I still new to JPOS and ....

When are you going to stop using this as an excuse to rtfm?  And ask
smart questions!

:-)

--
Mark

--
--
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/caddf7c0-8328-96d7-569f-b9f724b814d6%40talktalk.net.
For more options, visit https://groups.google.com/d/optout.