I am sending this message to the ISOServer but I am getting invalid
message length. Please find the error.
F2F8F0F42030018000000000F0F0F0F0F0F0F6F8F0F0F0F1F0F6F1F1F0F9F0F9F1F3F1F6F8F3F1F8F7F0F3
<log realm="iso-server.channel/157.227.42.24:1188" at="Thu Nov 09
21:42:15 MST 2006.15">
<receive>
<iso-exception>
Invalid message length ....
at
org.jpos.iso.channel.ASCIIChannel.getMessageLength(ASCIIChannel.java:91)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:499)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:125)
at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:51)
</iso-exception>
</receive>
</log>
How can I resolve this ? What configuration/code changes need to be
Done.?. Any help appreciated
Thanks in advance
patrick
Hi ,
I am sending this message to the ISOServer but I am getting invalid
message length. Please find the error.
F2F8F0F42030018000000000F0F0F0F0F0F0F6F8F0F0F0F1F0F6F1F1F0F9F0F9F1F3F1F6F8F3F1F8F7F0F3
<log realm="iso-server.channel/157.227.42.24:1188" at="Thu Nov 09
21:42:15 MST 2006.15">
<receive>
<iso-exception>
Invalid message length ....
at
org.jpos.iso.channel.ASCIIChannel.getMessageLength (ASCIIChannel.java:91)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:499)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:125)
at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java :51)
</iso-exception>
</receive>
</log>
How can I resolve this ? What configuration/code changes need to be
Done.?. Any help appreciated
Thanks in advance
patrick
Alwyn Schoeman
Thanks for your response.
Is there any way to proceed without message length?
I am sending this message from client
F2F8F0F42030018000000000F0F0F0F0F0F0F6F8F0F0F0F1F0F6F1F1F0F9F0F9F1F3F1F6F8F3F1F8F7F0F3
Thanks In advance
Patrick
Thanks for your resonse. Please more details about the issue..
This is the code used by client to send message to Server.
//Client code
String length;
message
="F2F8F0F42030018000000000F0F0F0F0F0F0F6F8F0F0F0F1F0F6F1F1F0F9F0F9F1F3F1F6F8F3F1F8F7F0F3"
out = clientSock.getOutputStream();
for(length = Integer.toHexString(Util.decode(message).length + 2);
length.length() < 4; length = "0" + length);
message = length + message;
byte b[] = Util.decode(message);
out.write(byteArray);
// Client code portion ends
I am using following JPOS server code
//Server Code
strInterface ="c:/interface.xml"
GenericPackager p;
p = new GenericPackager(strInterface);
ISOChannel clientSideChannel = new ASCIIChannel(p);
ISOServer server = new ISOServer ( port, (ServerChannel)
clientSideChannel, pool);
// Server code ends
Please tell me how can i configure/code to accept the client message.?
Please find the interface .xml also.
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE
isopackager SYSTEM
"genericpackager.dtd"><isopackager><isofield id="0" length="4"
name="MESSAGE TYPE INDICATOR" pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="1"
length="16"
name="BIT MAP"
class="com.message.iso.IFB_BITMAP"/>
<isofield
id="2"
length="19"
name="PAN - PRIMARY ACCOUNT NUMBER"
pad="false"
class="com.message.iso.IFE_LLNUM"/>
<isofield
id="3"
length="6"
name="PROCESSING CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="4"
length="12"
name="AMOUNT, TRANSACTION"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="5"
length="12"
name="AMOUNT, SETTLEMENT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="6"
length="12"
name="AMOUNT, CARDHOLDER BILLING"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="7"
length="10"
name="TRANSMISSION DATE AND TIME"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="8"
length="8"
name="AMOUNT, CARDHOLDER BILLING FEE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="9"
length="8"
name="CONVERSION RATE, SETTLEMENT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="10"
length="8"
name="CONVERSION RATE, CARDHOLDER BILLING"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="11"
length="6"
name="SYSTEM TRACE AUDIT NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="12"
length="12"
name="DATE AND TIME, LOCAL TRANSACTION"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="13"
length="4"
name="DATE, EFFECTIVE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="14"
length="4"
name="DATE, EXPIRATION"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="15"
length="6"
name="DATE, SETTLEMENT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="16"
length="4"
name="DATE, CONVERSION"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="17"
length="4"
name="DATE, CAPTURE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="18"
length="4"
name="MERCHANTS TYPE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="19"
length="3"
name="ACQUIRING INSTITUTION COUNTRY CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="20"
length="3"
name="PAN EXTENDED COUNTRY CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="21"
length="3"
name="FORWARDING INSTITUTION COUNTRY CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="22"
length="12"
name="POINT OF SERVICE DATA CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="23"
length="3"
name="CARD SEQUENCE NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="24"
length="3"
name="FUNCTION CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="25"
length="4"
name="MESSAGE REASON CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="26"
length="4"
name="CARD ACCEPTOR BUSINESS CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="27"
length="1"
name="AUTHORIZATION IDENTIFICATION RESP LEN"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="28"
length="9"
name="AMOUNT, TRANSACTION FEE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="29"
length="9"
name="AMOUNT, SETTLEMENT FEE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="30"
length="24"
name="AMOUNT, ORIGINAL"
pad="true"
class="com.message.iso.IFE_NUMERIC">
</isofield>
<isofield
id="31"
length="48"
name="ACQUIRER REFERENCE DATA"
class="com.message.iso.IFE_LLCHAR">
</isofield>
<isofield
id="32"
length="11"
name="ACQUIRING INSTITUTION IDENT CODE"
pad="false"
class="com.message.iso.IFE_LLNUM"/>
<isofield
id="33"
length="11"
name="FORWARDING INSTITUTION IDENT CODE"
pad="false"
class="com.message.iso.IFE_LLNUM"/>
<isofield
id="34"
length="28"
name="PAN EXTENDED"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="35"
length="37"
name="TRACK 2 DATA"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="36"
length="104"
name="TRACK 3 DATA"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="37"
length="12"
name="RETRIEVAL REFERENCE NUMBER"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="38"
length="6"
name="AUTHORIZATION IDENTIFICATION RESPONSE"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="39"
length="3"
name="RESPONSE CODE"
class="com.message.iso.IFE_CHAR">
</isofield>
<isofield
id="40"
length="3"
name="SERVICE RESTRICTION CODE"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="41"
length="8"
name="CARD ACCEPTOR TERMINAL IDENTIFICACION"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="42"
length="15"
name="CARD ACCEPTOR IDENTIFICATION CODE"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="43"
length="99"
name="CARD ACCEPTOR NAME/LOCATION"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="44"
length="25"
name="ADITIONAL RESPONSE DATA"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="45"
length="76"
name="TRACK 1 DATA"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="46"
length="999"
name="ADITIONAL DATA - ISO"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="47"
length="287"
name="ADITIONAL DATA - NATIONAL"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="48"
length="40"
name="ADITIONAL DATA - PRIVATE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="49"
length="3"
name="CURRENCY CODE, TRANSACTION"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="50"
length="3"
name="CURRENCY CODE, SETTLEMENT"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="51"
length="3"
name="CURRENCY CODE, CARDHOLDER BILLING"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="52"
length="8"
name="PIN DATA"
class="com.message.iso.IFB_BINARY"/>
<isofield
id="53"
length="8"
name="SECURITY RELATED CONTROL INFORMATION"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="54"
length="120"
name="ADDITIONAL AMOUNTS"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="55"
length="255"
name="INTEGRATED CARD CIRCUIT SYSTEM RELATED DATA"
class="com.message.iso.IFB_LLLCHAR"/>
<isofield
id="56"
length="35"
name="ORIGINAL DATA ELEMENTS"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="57"
length="3"
name="AUTHORIZATION LIFE CYCLE CODE"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="58"
length="11"
name="AUTHORIZING AGENT INSTITUTION IDENTIFICATION CODE"
class="com.message.iso.IFE_LLNUM"/>
<isofield
id="59"
length="99"
name="TRANSPORT DATA"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="60"
length="300"
name="NATIONAL USE DATA"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="61"
length="100"
name="NATIONAL USE DATA"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="62"
length="60"
name="PRIVATE USE DATA"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="63"
length="205"
name="PRIVATE USE DATA"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="64"
length="8"
name="MESSAGE AUTHENTICATION CODE FIELD"
class="com.message.iso.IFB_BINARY"/>
<isofield
id="65"
length="1"
name="BITMAP, EXTENDED"
class="com.message.iso.IFB_BINARY"/>
<isofield
id="66"
length="1"
name="SETTLEMENT CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="67"
length="2"
name="EXTENDED PAYMENT CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="68"
length="3"
name="RECEIVING INSTITUTION COUNTRY CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="69"
length="3"
name="SETTLEMENT INSTITUTION COUNTRY CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="70"
length="3"
name="NETWORK MANAGEMENT INFORMATION CODE"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="71"
length="4"
name="MESSAGE NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="72"
length="4"
name="MESSAGE NUMBER LAST"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="73"
length="6"
name="DATE ACTION"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="74"
length="10"
name="CREDITS NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="75"
length="10"
name="CREDITS REVERSAL NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="76"
length="10"
name="DEBITS NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="77"
length="10"
name="DEBITS REVERSAL NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="78"
length="10"
name="TRANSFER NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="79"
length="10"
name="TRANSFER REVERSAL NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="80"
length="10"
name="INQUIRIES NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="81"
length="10"
name="AUTHORIZATION NUMBER"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="82"
length="12"
name="CREDITS, PROCESSING FEE AMOUNT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="83"
length="12"
name="CREDITS, TRANSACTION FEE AMOUNT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="84"
length="12"
name="DEBITS, PROCESSING FEE AMOUNT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="85"
length="12"
name="DEBITS, TRANSACTION FEE AMOUNT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="86"
length="16"
name="CREDITS, AMOUNT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="87"
length="16"
name="CREDITS, REVERSAL AMOUNT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="88"
length="16"
name="DEBITS, AMOUNT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="89"
length="16"
name="DEBITS, REVERSAL AMOUNT"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="90"
length="42"
name="ORIGINAL DATA ELEMENTS"
pad="true"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="91"
length="1"
name="FILE UPDATE CODE"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="92"
length="2"
name="FILE SECURITY CODE"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="93"
length="11"
name="RESPONSE INDICATOR"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="94"
length="11"
name="SERVICE INDICATOR"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="95"
length="42"
name="REPLACEMENT AMOUNTS"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="96"
length="18"
name="MESSAGE SECURITY CODE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="97"
length="17"
name="AMOUNT, NET SETTLEMENT"
pad="false"
class="com.message.iso.IFE_NUMERIC"/>
<isofield
id="98"
length="25"
name="PAYEE"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="99"
length="11"
name="SETTLEMENT INSTITUTION IDENT CODE"
pad="false"
class="com.message.iso.IFE_LLNUM"/>
<isofield
id="100"
length="11"
name="RECEIVING INSTITUTION IDENT CODE"
pad="false"
class="com.message.iso.IFE_LLNUM"/>
<isofield
id="101"
length="17"
name="FILE NAME"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="102"
length="28"
name="ACCOUNT IDENTIFICATION 1"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="103"
length="28"
name="ACCOUNT IDENTIFICATION 2"
class="com.message.iso.IFE_LLCHAR"/>
<isofield
id="104"
length="100"
name="TRANSACTION DESCRIPTION"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="105"
length="999"
name="RESERVED ISO USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="106"
length="999"
name="RESERVED ISO USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="107"
length="999"
name="RESERVED ISO USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="108"
length="999"
name="RESERVED ISO USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="109"
length="999"
name="RESERVED ISO USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="110"
length="999"
name="RESERVED ISO USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="111"
length="999"
name="RESERVED ISO USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="112"
length="999"
name="RESERVED NATIONAL USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="113"
length="999"
name="RESERVED NATIONAL USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="114"
length="999"
name="RESERVED NATIONAL USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="115"
length="999"
name="RESERVED NATIONAL USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="116"
length="999"
name="RESERVED NATIONAL USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="117"
length="999"
name="RESERVED NATIONAL USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="118"
length="999"
name="RESERVED NATIONAL USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="119"
length="999"
name="RESERVED NATIONAL USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="120"
length="999"
name="RESERVED PRIVATE USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="121"
length="999"
name="RESERVED PRIVATE USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="122"
length="999"
name="RESERVED PRIVATE USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="123"
length="999"
name="RESERVED PRIVATE USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="124"
length="3"
name="DEBIT FUNCTION CODE"
class="com.message.iso.IFE_CHAR"/>
<isofield
id="125"
length="999"
name="RESERVED PRIVATE USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="126"
length="999"
name="RESERVED PRIVATE USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="127"
length="999"
name="RESERVED PRIVATE USE"
class="com.message.iso.IFE_LLLCHAR"/>
<isofield
id="128"
length="8"
name="MAC 2"
class="com.message.iso.IFB_BINARY"/>
</isopackager>
I assume you have been presented with a test message that a client will
be sending to your server?
My guess is that you are attempting to simulate their end of the
processing in order that you can work on your server without their input?
This test message looks like it is a hexadecimal representation of an
EBCDIC message - an 0824 message with an 8 byte binary bitmap?
You have not indicated what Util.decode(String m) does but it looks like
it returns a byte[] of the message, but I wonder of what bytes.
On this test message does it return 43 bytes or 86. I think it should
be 43 bytes, and perhaps you are converting from EBCDIC to ASCII in the
same method?
What on earth do you put in byteArray, that is the interesting bit, it
is what you are sending after all.
There is so much wrong with this test that rather than try and get it
working, I suggest you go back to the drawing board.
You need to start with talking to the provider of the message:-
Ask them basic question about the proposed exchange :-
1. What character set do they use - EBCDIC or ASCII.
2. Do they have a specification of the message you can have.
3. How will the message be packaged to traverse the network, how many
bytes will indicate the message length, are there any headers or trailers?
If you already have this information, perhaps you can share them when
asking your question?
Answers to these questions will help you chose the right (or nearest)
jPOS components you should be trying to use.
One last pointer...
Read if you can :-
http://catb.org/esr/faqs/smart-questions.html
--
Mark
Sorry for the confusion.
Plesae find my answers to ur questions
1>The message is a hex representation of an EBCIDIC message ( ISO 8583)
with following information.
MTI: 2804
BitMap: 2030018000000000
Fields and its values arew
3 PROCESSING CODE (000000)
11 SYSTEMS TRACE AUDIT NUMBER(680001)
12 DATE AND TIME, LOCAL TRANSACTION (061109091316 )
24 FUNCTION CODE(831)
25 MESSAGE REASON CODE(8703)
2> Client code details
//Client code
String length;
message
="F2F8F0F42030018000000000F0F0F0F0F0F0F6F8F0F0F0F1F0F6F1F1F0F9F0F9F1F3F1F6F8F3F1F8F7F0F3";
out = clientSock.getOutputStream();
for(length = Integer.toHexString(Util.decode(message).length + 2);
length.length() < 4; length = "0" + length);
message = length + message; // Message appended with message
length 002d
/* Now message is
=002dF2F8F0F42030018000000000F0F0F0F0F0F0F6F8F0F0F0F1F0F6F1F1F0F9F0F9F1F3F1F6F8F3F1F8F7F0F3*/
byte b[] = Util.decode(message);
/* the byte array values are
byteArray[0]=0
byteArray[1]=45
byteArray[2]=-14
byteArray[3]=-8
byteArray[4]=-16
byteArray[5]=-12
byteArray[6]=32
byteArray[7]=48
byteArray[8]=1
byteArray[9]=-128
byteArray[10]=0
byteArray[11]=0
byteArray[12]=0
byteArray[13]=0
byteArray[14]=-16
byteArray[15]=-16
byteArray[16]=-16
byteArray[17]=-16
byteArray[18]=-16
byteArray[19]=-16
byteArray[20]=-10
byteArray[21]=-8
byteArray[22]=-16
byteArray[23]=-16
byteArray[24]=-16
byteArray[25]=-15
byteArray[26]=-16
byteArray[27]=-10
byteArray[28]=-15
byteArray[29]=-15
byteArray[30]=-16
byteArray[31]=-7
byteArray[32]=-16
byteArray[33]=-7
byteArray[34]=-15
byteArray[35]=-13
byteArray[36]=-15
byteArray[37]=-10
byteArray[38]=-8
byteArray[39]=-13
byteArray[40]=-15
byteArray[41]=-8
byteArray[42]=-9
byteArray[43]=-16
byteArray[44]=-13
*/
out.write(byteArray);
// Client code portion ends
3> the message specification is ISO 8583.
Hope this helps..
Currently i am using following JPOS server code to accept the message
from client and getting invalid message length exception.What
configuration/code change need to be done ? Is it poosible ? Or Do i
need to provide extara info?
//Server Code
strInterface ="c:/interface.xml"
GenericPackager p;
p = new GenericPackager(strInterface);
ISOChannel clientSideChannel = new ASCIIChannel(p);
ISOServer server = new ISOServer ( port, (ServerChannel)
clientSideChannel, pool);
// Server code ends
Thanks in Advance
ptrick
>
> 2> Client code details
>
> //Client code
Is this really you client's code, or just your guess at what and how
they will be sending a message?
>
> String length;
> message
> ="F2F8F0F42030018000000000F0F0F0F0F0F0F6F8F0F0F0F1F0F6F1F1F0F9F0F9F1F3F1F6F8F3F1F8F7F0F3";
> out = clientSock.getOutputStream();
> for(length = Integer.toHexString(Util.decode(message).length + 2);
> length.length() < 4; length = "0" + length);
> message = length + message; // Message appended with message
> length 002d
>
> /* Now message is
> =002dF2F8F0F42030018000000000F0F0F0F0F0F0F6F8F0F0F0F1F0F6F1F1F0F9F0F9F1F3F1F6F8F3F1F8F7F0F3*/
>
> byte b[] = Util.decode(message);
This is a *very* rough driver, but at least we can see that the
resultant byteArray holds the bytes containing EBCDIC characters.
>
> 3> the message specification is ISO 8583.
That is a message standard that defines possible message structures. It
is not the specification of the client message under this standard.
Their specification will define how each field is structured and what
the valid values are and also the message flows and (for example) what
they expect to see in response to this 2804 message.
>
> Hope this helps..
Not really, but...
ASCIIChannel expects 4 bytes as the message length, you are only
providing two bytes. This results in your server taking the first 4
bytes as the length (x'002df2f8' = 3011320 bytes). JPOS then takes the
next 4 bytes as the MTI (x'f0f42030') and then attempts to use a bit map
of x'0180'...
As you can see this is wrong because we start out badly with the badly
formed length.
>
> Currently i am using following JPOS server code to accept the message
> from client and getting invalid message length exception.What
> configuration/code change need to be done ? Is it poosible ? Or Do i
> need to provide extara info?
First you need to know how many bytes the client will send as the
message length and also if these bytes include the length of the length
or just the number of bytes that follows.
This will allow you to pick the correct jPOS Channel for the client
communication.
The absolutely correct one may not be available, but don't worry it is
really easy to pick the closest and modify it to match your clients
requirements.
--
Mark
Thanks for your response. Please find more details.
The following code is a single class with sends message to server and
get response from server.
If I run the class i am getting following ouput with my original
serevr.
message with
length=002dF2F8F0F42030018000000000F0F0F0F0F0F0F6F8F0F0F0F1F0F6F1F1F0F9F0F9F1F3F1F6F8F3F1F8F7F0F3
response with
length=001DF2F8F1F42020000002000000F0F0F0F0F0F0F6F8F0F0F0F1F8F0F0
response=F2F8F1F42020000002000000F0F0F0F0F0F0F6F8F0F0F0F1F8F0F0
But if i send message to JPos server i a getting invalid message
length. The JPOS server details mentioned in the earlier sections.
Request Message info
--------------------
The Message type is: 2804
The BitMap string is: 2030018000000000
PROCESSING CODE F0F0F0F0F0F0 ( 000000 )
SYSTEMS TRACE AUDIT NUMBER F6F8F0F0F0F1 ( 680001 )
DATE AND TIME, LOCAL TRANSACTION F0F6F1F1F0F9F0F9F1F3F1F6 (
061109091316 )
FUNCTION CODE F8F3F1 ( 831 )
MESSAGE REASON CODE F8F7F0F3 ( 8703 )
Response Message info
---------------------
The Message type is: 2814
The BitMap string is: 2020000002000000
fields are:
PROCESSING CODE F0F0F0F0F0F0 ( 000000 )
SYSTEMS TRACE AUDIT NUMBER F6F8F0F0F0F1 ( 680001 )
ACTION CODE F8F0F0 ( 800 )
import java.io.*;
import java.net.*;
import java.nio.ByteBuffer;
import java.nio.channels.*;
import java.util.Iterator;
import java.util.Set;
public class client
{
static boolean IS_CONNECTED=false;
Socket clientSock;
OutputStream out;
BufferedInputStream bins;
int timeout;
String response;
public client()
{
}
public void connect(String IP, int port) throws UnknownHostException,
IOException
{
if(!client.IS_CONNECTED)
{
long starttime = System.currentTimeMillis();
clientSock = null;
timeout = 26000;
BufferedInputStream bis;
out = null;
bis = null;
clientSock = new Socket(IP, port);
clientSock.setSoTimeout(timeout);
client.IS_CONNECTED=true;
}
}
public void init(String IP, int port, String message) throws
UnknownHostException, IOException
{
connect(IP,port);
out = clientSock.getOutputStream();
bins = new BufferedInputStream(clientSock.getInputStream());
String length;
for(length = Integer.toHexString(decode(message).length + 2);
length.length() < 4; length = "0" + length);
message =length + message;
System.out.println("message="+message);
byte byteArray[] =decode(message);
out.write(byteArray);
byte trace[] = new byte[400];
int n = bins.read(trace, 0, 400);
int x = 0;
StringBuffer resp = new StringBuffer();
for(int p = 0; p < n; p++)
{
x = trace[p];
short len = (short)Integer.toHexString(x).length();
if(len == 1)
resp.append("0" + Integer.toHexString(x).toUpperCase());
if(len > 1)
resp.append(Integer.toHexString(x).toUpperCase().substring(len - 2,
len));
}
System.out.println("response with length="+resp);
response = resp.substring(4);
System.out.println("response="+response);
}
public static byte[] decode(String str)
throws IndexOutOfBoundsException
{
int oddLength = str.length() % 2;
byte res[] = new byte[str.length() / 2 + oddLength];
int i = 0;
if(oddLength == 1)
res[i++] = (byte)Character.digit(str.charAt(0), 16);
for(i = oddLength; i < res.length; i++)
{
int v = Character.digit(str.charAt(i * 2), 16) << 4;
v |= Character.digit(str.charAt(i * 2 + 1), 16);
res[i] = (byte)v;
}
return res;
}
public static void main(String args[])
{
client c=new client();
try {
c.init("localhost", 6800,
"F2F8F0F42030018000000000F0F0F0F0F0F0F6F8F0F0F0F1F0F6F1F1F0F9F0F9F1F3F1F6F8F3F1F8F7F0F3");
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Thanks & Regards
patrick
So you have a two byte binary length that includes the length of itself
with the length of the message in it's value
>
>
> But if i send message to JPos server i a getting invalid message
> length. The JPOS server details mentioned in the earlier sections.
You are using the wrong Channel - ASCIIChannel wants a 4 byte length.
I would extending RawChannel, adjusting the length handling down to two
bytes and adjusting this length to take out the "length of my self".
There are jPOS Channels that take a two byte length, but as far as I
know the length fields do not include their own length. So you need to
evolve your own.
--
Mark