Fixed valueTemplate

29 views
Skip to first unread message

Rakesh

unread,
Sep 12, 2008, 8:40:09 AM9/12/08
to jPOS Users
hi Andy
i had seen u r post regarding fixed value template

<isomsg>
<field id="19" value="840" />
<field id="24" value="182" />
<field id="25" value="1900" />
<field id="26" value="5912" />
<field id="32" value="05682" />
</isomsg>


public class QueryAMEXHost extends QueryHost {
protected String getResourcePrefix() {
return "AMEX.ISO";
}
}
in transaction manager.xml i have written participant like
QueryHost
Context ctx = (Context)context;
ctx.checkPoint("start"+new Date());
try{
ISOMsg req=(ISOMsg)ctx.get("REQUEST");

MUX mux=(MUX)NameRegistrar.get("mux.mux");
mux.request(req,30000L , new RISOResponseListener(), ctx);

can u please guide me how to keep the template specified in the cfg
folder to get part of my participant where i am keeping my request in
mux





Andy Orrock

unread,
Sep 12, 2008, 10:48:42 AM9/12/08
to jpos-...@googlegroups.com
Hi Rakesh -

I'm not sure I understand your question 100%. Regardless, this info will
probably give you the insight and direction you need...

We have a participant in our TransactionManager that looks like this:

<group name="QueryAMEX">
<participant class="org.jpos.nnn.CreateAMEXRequest"
logger="Q2" realm="create-amex-request">
<property name="mti" value="1100" />
<property name="pcode" value="004000" />
<property name="space" value="jdbm:amex-stan" />
<property name="template" value="cfg/amex-template.xml" />
<property name="checkpoint" value="create-amex-request" />
</participant>
&query_amex_host;
&credit_response;
</group>

Then, we do something like this in our code where we create the outbound
ISO8583 request (these are not contiguous lines...I'm plucking the relevant
lines):

protected ISOMsg templateMsg;

[SNIP]

ISOMsg m = (ISOMsg) templateMsg.clone();

[SNIP]

templateMsg = getTemplate (cfg.get ("template"));

[SNIP]

protected ISOMsg getTemplate (String filename)
throws IOException, ISOException
{
String k = getClass().getName()+"."+filename;
ISOMsg m = (ISOMsg) sp.rdp (k);
if (m == null) {
m = new ISOMsg ();
File templateFile = new File (filename);
if (templateFile.canRead()) {
LogEvent evt = createInfo ();
FileInputStream fis = new FileInputStream (templateFile);
byte[] b = new byte[fis.available()];
fis.read (b);
m.setPackager (new XMLPackager ());
m.unpack (b);
evt.addMessage ("<template-file>" + filename +
"</template-file>");
evt.addMessage (m);
Logger.log (evt);
} else {
m = new ISOMsg(); // dummy message
}
sp.out (k, m, 60000L);
}
return m;

Reply all
Reply to author
Forward
0 new messages