Jpos log

59 views
Skip to first unread message

DHANDAPANI D

unread,
Jul 16, 2024, 2:54:22 AMJul 16
to jPOS Users
Hi,

I'm get my incoming request hex using ISOUtil.hexdump(message.pack());

I wanna log my request and response in xml formate as like jpos . is there any inbuilt function available? 

Eg:
<receive>
    <isomsg direction="incoming">
      <!-- org.jpos.iso.packager.GenericPackager[C:\Users\ddurairaj2\Downloads\Responder_Setup\Packager\Responder_Packager.xml] -->
      <header>xxxxxxxxxxxxxxxxxxxxxxxxxxx</header>
      <field id="0" value="0200"/>
      <field id="2" value="xxxxxxxxxxxxx"/>
      <field id="3" value="xxxxxx"/>
      <field id="4" value="xxxxxxxxxxxx"/>
      <field id="7" value="xxxxxxxxxx"/>
      <field id="11" value="xxxxxx"/>
      <field id="12" value="xxxxxx"/>
      <field id="13" value="xxxxxx"/>
      <field id="15" value="xxxxxx"/>
      <field id="17" value="xxxxxx"/>
      <field id="32" value="xxxxxxxxxxx"/>
      <field id="33" value="xxxxxx"/>
      <field id="37" value="xxxxxxxxxxxx"/>
      <field id="41" value="xxxxxxxxxxxxxxxx"/>
      <field id="42" value="xxxxxxxxxxxxxxx"/>
      <field id="43" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
      <field id="49" value="xxx"/>
      <field id="60" value="xxxxxxxxxxxxxxxx"/>
      <field id="125" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
    </isomsg>
  </receive>

Thanks,
Dhandapani D

murtuza chhil

unread,
Jul 16, 2024, 3:55:27 AMJul 16
to jPOS Users

message.dump(System.out, "");

-chhil

DHANDAPANI D

unread,
Jul 16, 2024, 6:09:54 AMJul 16
to jPOS Users
Hi Chill,

log.info("Request Message xml ==============> "+message.dump(System.out, "").toString());

for this i'm getting void

Jpos log: 

</log>
<log realm="request-listener" at="2024-07-16T14:51:53.412">
  <info>
    Request Message xml ==============> 
void
  </info>
</log>


Thanks,
Dhandapani.D

murtuza chhil

unread,
Jul 16, 2024, 7:09:25 AMJul 16
to jPOS Users


String hexMesage = "F1F2F0F05000000000000000F1F0F1F2F3F4F5F6F7F8F9F0F0F0F0F0F0F0F0F0F1F0F0F0";


GenericPackager pkgr = new GenericPackager("path to your xml defined packager");

ISOMsg message = new ISOMsg("1200");

message.setPackager(pkgr);

message.unpack(ISOUtil.hex2byte(hexMesage));

ByteArrayOutputStream baos = new ByteArrayOutputStream();

// Create a PrintStream that writes to the ByteArrayOutputStream

PrintStream ps = new PrintStream(baos);


message.dump(ps, "");

System.out.println(baos.toString());




Output

<isomsg direction="none">

<!-- org.jpos.iso.packager.GenericPackager[path to your xml defined packager] -->

<field id="bitmap" value="{2, 4}" type="bitmap"/>

<field id="0" value="1200"/>

<field id="2" value="1234567890"/>

<field id="4" value="000000001000"/>

</isomsg>


-chhil

Mark Salter

unread,
Jul 16, 2024, 7:10:13 AMJul 16
to jpos-...@googlegroups.com
On 16/07/2024 10:28, DHANDAPANI D wrote:
> log.info("Request Message xml ==============> "+message.dump(System.out,
> "").toString());
>
> for this i'm getting *void*
And you will...

... message.dump writes the xml form to the OutputStream given to it and
returns nothing hence your toString() result.  Check you console and
then check your question :-)


--

Mark

signature.asc

Andrés Alcarraz

unread,
Jul 16, 2024, 8:08:10 AMJul 16
to jPOS Users
It seems log is an instance of jPOS Logger. You just need:

log.info(message)

And immediately after that, read the jPOS doc.  http://jpos.org/doc/proguide-draft.pdf

----
Enviado desde mi móvil, disculpas por la brevedad.

Sent from my cellphone, I apologize for the brevity.

--
--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/f7410b40-64f3-4faa-bf72-b3db70e57c66n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages