Best Regards,
Anthony
I had to do something similar with a constant header in a FSD Message: my
schema looks like:
<schema>
<field id="header" type="K" length="7" >ABCDEFG</field>
<field id="0" type="N" length="2" /> <!--
tran-type-->
<field id="41" type="A" length="8" /> <!--
store-number -->
<field id="46" type="N" length="19" /> <!-- id -->
<field id="39" type="A" length="2"/> <!--
response-code -->
..snip...
</schema>
you could do something like:
<schema>
<field id="header" type="K" length="3">STX</field>
<field id="41" type="AFS"/> <!-- John's fields -->
..snip...
<field id="trailer" type="K" length="3">ETX</field>
</schema>
and use type=AFS for the <FS> delimited fields that you have.
some small snippets to create the FSDISO message
...
protected ISOMsg createISOMsg(Context ctx) throws Exception {
...
FSDMsg fsd = new FSDMsg ("file:cfg/schema.xml)
fsd.set("41","value");
....
return new FSDISOMsg (fsd);
Regards,
David Bergert
www.paymentsystemsblog.com
org.jpos.iso.FSDISOMsg
org.jpos.iso.channel.FSDChannel
org.jpos.iso.packager.DummyPackager
You can use something like:
<channel-adaptor name='yourchannel'
class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">
<channel class="org.jpos.iso.channel.FSDChannel" logger="Q2" realm="yourrealm"
packager="org.jpos.iso.packager.DummyPackager">
<property name="host" value="your.host" />
<property name="port" value="nnnn" />
<property name="schema" value="file:cfg/your-schema-" />
</channel>
<in>your-send</in>
<out>your-receive</out>
<reconnect-delay>10000</reconnect-delay>
</channel-adaptor>
The code is straight forward, you'll see that we need the DummyPackager
just to keep the channel adaptor happy.
You'll probably have to modify your STXETXChannel based on FSDChannel.
Please let us know if this works for you.
Best Regards,
Anthony
>
> Based on what you have provided I no longer feel dumb as a rock and
> believe that I will be able to tie it all together now.
>
Great, I hope that was a jPOS Ah-ha! moment :)
To confirm: Yes, Alejandro designed & we tested and implemented FSDISOMsg
as part of requirement to establish a remote authorization connection to
Verizon (phone card activation). You can read about the project and some
follow-ups in a post I did here:
As Dave mentioned, he recently re-purposed the core FSDISOMsg work for our
MethCheck requirements. You can read about Dave's experiences here:
FSDISOMsg has proven to be very adaptable and reliable.
Andy Orrock
-----Original Message-----
From: jpos-...@googlegroups.com [mailto:jpos-...@googlegroups.com] On
Wouldn't our MUXPool implementation work for you using the existing keys?
Have you looked at the little 'keys' trick implemented as discussed in my
blog entry on this matter:
We name two of the response fields '11' and '41', which allows us to
leverage the default keys.
As I mention in my post:
"Here's the linchpin of the approach: The QMUX key fields have to be named
with their ISO equivalents. You can see below that we have two fields that
equate directly to 41 and 11 (QMUX's default key - the TID and STAN
respectively), so we named them as such in the XML structure. Anything you
put in the mux key you need to tie in here."
Is this what you're asking? (I'm agreeing with Alejandro's comment.)
Andy Orrock
-----Original Message-----
From: jpos-...@googlegroups.com [mailto:jpos-...@googlegroups.com] On
Behalf Of Alejandro Revilla
Sent: Tuesday, June 24, 2008 4:57 PM
To: jpos-...@googlegroups.com
Subject: Re: FSDMsg Usage
>
> So, long story short - I know I need to use keys for the QMUX to
> locate it but the host does not return that info.
>
The ISOMsg keeps a weak reference to the ISOSource (see
ISOMsg.getSource()), if you use stuff like that in the FSDISOMsg you may
be able to create a suitable key based on an unique endpoing socket
identifier (wild guessing here but could be food for thought).
>
> I am thinking that I can put the key and the Back-end node into the
> space and when that channel returns data I can first look in the space
> to get the key, merge it back to the msg and then return it to the
> space where it will get picked up like everything else. As a side
> note, when I send the TXN to a back-end node, the node can not get
> another TXN until it responds so I will be flaging the Back-end node
> as busy (if needed) and reseting it (dropping the connection) if it
> times out.
>
If carrying that reference around through the ISOMsg.setSource/getSource
is not an option, then the Space is always a good solution.
>
> Sorry for the long response but it is complicated and not very
> straightforward, but it will be extremely powerful if I can get it
> tied together.
>
It's sad that the people that design these proprietary protocols doesn't
think about situations like this that could be solved with just a simple
handback field. In our ISO-8583 based internal message format we have
assorted handback fields of several sizes to make programmer's life
easier.
In one of our ISO-8583 v87 to v2003 converters (SS implementation as
described in the blog) we use a handback binary field to place a binary
copy of the request in packed format, which comes very handy to populate
the responses.
--Alejandro
>
> Andy - I had previously read your document (excellent btw) and when I
> receive the msg I do create keys but the back-end system does not
> maintain them. For example - The host can return just one field (short
> error msg) and that is it.>
The keys do not have to be plural -- it can be a single field, as long it is
unique -- Do you not have a unique value that lives in both the request and
response messages ? Does the other host have a "echo" or user data type
field that could be used ?
> So, long story short - I know I need to use keys for the QMUX to
> locate it but the host does not return that info. I am thinking that
> I can put the key and the Back-end node into the space and when that
> channel returns data I can first look in the space to get the key,
> merge it back to the msg and then return it to the space where it will
> get picked up like everything else. As a side note, when I send the
> TXN to a back-end node, the node can not get another TXN until it
> responds so I will be flaging the Back-end node as busy (if needed)
> and reseting it (dropping the connection) if it times out.
This sounds reasonable, given if there is no "key" that you can use.
"B" is Binary
"A" is Alpha/Numeric/String
see line 171: in modules/jpos/src/org/jpos/util/FSDMSG.java to see how they
are handled.
--Dave
www.paymentsystemsblog.com
> -----Original Message-----
> From: jpos-...@googlegroups.com [mailto:jpos-...@googlegroups.com] On
> Does FSDMsg only supports fixed length field?
No
> Can FSDMsg supports variable length field? let say 2 bytes of length.
Yes, I think you are missing an important point?
In an FSDMsg, the field length is determined via the field separators
which mark the end of one field and the start of the next.
--
Mark
Is 47183F7AA03F6B1B the value you see leaving your system even though
your code places the 47189B7AA08E6B1B?
Do you control the client side as well, can you confirm this is the data
being received or is a third party describing what they see?
If you can add a Logger to your Channel and packager, perhaps that will
give some clues.
If nothing is obvious, then as you appear to be using the windows
operating system, can you try using wireshark (
http://www.wireshark.org/ )- or similar to see the packets that are
actually being sent out of your network?
We can at least eliminate jPOS as the culprit if what you place as a MAC
goes out on the network message.
--
Mark
unpack (byte[])
and
unpack (InputStream)
you should be able to use the latter and unpack the message on the fly,
problem is I'm not sure you can use the first field as a key without
some hacking at the FSDMsg level (probably extending FSDMsg).
Please let us know if FSDMsg needs any change to allow that kind of
extension (i.e. at FSDMsg line 300 we may have to call a protected
method that you could override).