I'm trying to build a simulator in java using jpos.
However i'm able to send values to my switch but as per switch vendor they are not receiving proper values at tcpip level due to which the conversion is failing.
Please find the below log generated at my end during sending the data before socket stream.
Request sent to server
Clear String:
0200723A4401A8E19008166070658525235400011000000000150000020110150412345
61300000201020160119010680019206900000376070658525235400=24075203640000000000
428313349275RGB12345RGB12345 NPCI R-TECH GOREGAON(E)MUMBAI MHIN
022051005ATM010580050099935698BC03BEBAD073D9021121412220033000400085
Message Length : 291
Sent Hex Dump:
0000 30 32 30 30 37 32 33 41 34 34 30 31 41 38 45 31 0200723A4401A8E1
0010 39 30 30 38 31 36 36 30 37 30 36 35 38 35 32 35 9008166070658525
0020 32 33 35 34 30 30 30 31 31 30 30 30 30 30 30 30 2354000110000000
0030 30 30 31 35 30 30 30 30 30 32 30 31 31 30 31 35 0015000002011015
0040 30 34 31 32 33 34 35 36 31 33 30 30 30 30 30 32 0412345613000002
0050 30 31 30 32 30 31 36 30 31 31 39 30 31 30 36 38 0102016011901068
0060 30 30 31 39 32 30 36 39 30 30 30 30 30 33 37 36 0019206900000376
0070 30 37 30 36 35 38 35 32 35 32 33 35 34 30 30 3D 070658525235400=
0080 32 34 30 37 35 32 30 33 36 34 30 30 30 30 30 30 2407520364000000
0090 30 30 30 30 34 32 38 33 31 33 33 34 39 32 37 35 0000428313349275
00a0 52 47 42 31 32 33 34 35 52 47 42 31 32 33 34 35 RGB12345RGB12345
00b0 20 20 20 20 20 20 20 4E 50 43 49 20 52 2D 54 45 NPCI R-TE
00c0 43 48 20 47 4F 52 45 47 41 4F 4E 28 45 29 4D 55 CH GOREGAON(E)MU
00d0 4D 42 41 49 20 20 20 20 20 20 20 4D 48 49 4E 30 MBAI MHIN0
00e0 32 32 30 35 31 30 30 35 41 54 4D 30 31 30 35 38 22051005ATM01058
00f0 30 30 35 30 30 39 39 39 33 35 36 39 38 42 43 30 0050099935698BC0
0100 33 42 45 42 41 44 30 37 33 44 39 30 32 31 31 32 3BEBAD073D902112
0110 31 34 31 32 32 32 30 30 33 33 30 30 30 34 30 30 1412220033000400
0120 30 38 35 085
As per my switch vendor they should receive the value of bitmap in proper sequence and not as a HEX Value.
Please find the below sample line given by my switch vendor.
0000 30 32 30 30 72 3A 44 01 A8 E1 0200r:D¨á <--
Can any one please assist on this regards.
Please find my below code:
GenericPackager packager = new GenericPackager("basic.xml");
// Create ISO Message
ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(packager);
isoMsg.setMTI("0200");
isoMsg.set(2, "6070658525235400");
isoMsg.set(3, "11000");
isoMsg.set(4, "000000150000");
isoMsg.set(7, "0201101504");
isoMsg.set(11, "123456");
isoMsg.set(12, "130000");
isoMsg.set(13, "0201" );
isoMsg.set(15, "0201");
isoMsg.set(18, "6011");
isoMsg.set(22, "901");
// isoMsg.set(25, "00");
isoMsg.set(32, "800192");
isoMsg.set(33, "900000");
isoMsg.set(35, "6070658525235400=24075203640000000000");
isoMsg.set(37, "428313349275");
isoMsg.set(41 , "RGB12345");
isoMsg.set(42 , "RGB12345 ");
isoMsg.set(43 , "NPCI R-TECH GOREGAON(E)MUMBAI MHIN");
isoMsg.set(48 , "051005ATM0105800500999");
isoMsg.set(49 , "356");
isoMsg.set(52 , "98BC03BEBAD073D9");
isoMsg.set(61 , "121412220033000400085");
// print the DE list
logISOMsg(isoMsg);
byte[] send_PackedRequestData = isoMsg.pack();
:
:
outStream = new BufferedOutputStream(connection.getOutputStream());
outStream.write(send_PackedRequestData);
outStream.flush();
This question is flawed, it's not possible to help without studying the specs.
In addition, I hope the card you show there is a test card, otherwise, please notify the issuer to block it.
That said, you're probably using IFA_BITMAP instead of IFB_BITMAP, but that change will just solve your bitmap generation, you probably have many other fields badly configured.
Related
How I will unpack ISO message using JPOS library in java?
here is the sample ISO message.
0800. ..............1224190516424997001003
Sample Hex Dump:
30 38 30 30 82 20 01 00 00 00 00 00 04 00 00 00 0800. ..........
00 00 00 00 31 32 32 34 31 39 30 35 31 36 34 32 ....122419051642
34 39 39 37 30 30 31 30 30 33 4997001003
Please note that I have packed this above message using jpos library and bit map format is org.jpos.iso.IFB_BITMAP
If you want to unpack from the data you shared, you just need to use the same packager you used to pack the iso message to unpack what you generated.
You can instantiate a packager with the same parameters you used to pack the message and then:
ISOPackager pacakger = ....; //initialize the same way as used to pack
ISOMsg m = new ISOMsg();
//here we are using the hexdump since the plain data has non printable chars, because of the binary bitmap
byte[] packed = ISOUtil.decodeHexDump(
"30 38 30 30 82 20 01 00 00 00 00 00 04 00 00 00 0800. ..........\n" +
"00 00 00 00 31 32 32 34 31 39 30 35 31 36 34 32 ....122419051642\n" +
"34 39 39 37 30 30 31 30 30 33 4997001003");
packager.unpack(m, packed);
Alternatively you can
ISOMsg m = new ISOMsg();
m.setPackager(packager);
m.unpack(packed);
Provided that packed and packager variables are initialized in the ssame way as above.
And you will have the iso message content in the m variable.
Im currently working on a little game. before you have started the game I have a JFrame where you can setup your controllers. To do this im using the java built-in keylistener and it works great.
The problem occurs when im starting the game and the settings youve made doesn't work.
The game uses the lwjgl api and slick2d api and the keycode for when im checking for buttonpresses is different from the keycodes built in keylistener.
http://slick.ninjacave.com/javadoc/constant-values.html#org.newdawn.slick.Input.KEY_DOWN
A list of the keycodes slick uses. As you can see its different from this list
http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
is there a way to convert between these two?
I tried adding a constant but as you probably can see it wont work.
I appreciate every answer :)
I made a little solution now. Very simple maybe not the most effiecent but it works. Took some time though
I made a little list that i use for conversion. Could be some bugs but they are pretty easy so fix.
backspace 8 14
space 32 57
tab 9 15
enter 13 28
enter2 10 28
shift 16 42
ctrl 17 29
alt 18 56
pause 19 197
caps 20 58
escape 27 1
pgup 33 201
pgdo 34 209
end 35 207
home 36 199
left 37 203
up 38 200
right 39 205
down 40 208
insert2 155 210
delete 127 211
0 48 11
1 49 2
2 50 3
3 51 4
4 5 5
5 53 6
6 54 7
7 55 8
8 56 9
9 57 10
A 65 30
B 66 48
C 67 46
D 68 32
E 69 18
F 70 33
G 71 34
H 72 35
I 73 23
J 74 36
K 75 37
L 76 38
M 77 50
N 78 49
O 79 24
P 80 25
Q 81 16
R 82 19
S 83 31
T 84 20
U 85 22
V 86 47
W 87 17
X 88 45
Y 89 21
Z 90 44
Å 16777413 27
Ä 16777412 40
Ö 16777430 41
LWK 91 219
RWK 92 220
WINDOWS 524 219
SELECT 93 221
NUMPAD0 96 82
NUMPAD1 97 79
NUMPAD2 98 80
NUMPAD3 99 81
NUMPAD4 100 75
NUMPAD5 101 76
NUMPAD6 102 77
NUMPAD7 103 71
NUMPAD8 104 72
NUMPAD9 105 73
MULTIPLY 106 55
ADD 107 78
SUBTRACT 109 74
DECIMAL 110 83
DIVIDE 111 181
F1 112 59
F2 113 60
F3 114 61
F4 115 62
F5 116 63
F6 117 64
F7 118 65
F8 119 66
F9 120 67
F10 121 68
F11 122 87
F12 123 88
F13 124 100
F14 125 101
F15 126 102
NUMLOCK 144 69
SCROLLOCK2 145 70
SEMICOLON 186 39
EQUALSIGN 187 13
COMMA 188 51
COMMA2 44 51
DASH 189 12
PERIOD 190 52
PERIOD2 46 52
FORWARDSLASH 191 53
GRAVE 192 41
OPENBRACKET 219 26
BACKSLASH 220 43
CLOSEBRAKET 221 27
SINGLEQUOTE 222 40
§ 16777383 43
LESS 153 -1
DEADACUTE 129 -1
PLUS 521 13
MINUS 45 12
DeadDiaeresis 135 144
I have a server socket application which listens on particular ip and port. Then I have client socket which reads input from server and give response.
But my problem is that server do not give formatted line termination characters at the end. so when i use buffered reader readline method it hangs. so how should i read the data send by server.
here server is basically a API(METER).
Here is sample request/response sequence between server and client.
Request: 8/2/2012 3:28:24 PM.60764 (+0.0000 seconds)
53 0D S.
Answer: 8/2/2012 3:28:24 PM.87364 (+0.2656 seconds)
53 50 31 39 35 30 34 37 38 34 0D SP19504784.
Request: 8/2/2012 3:28:24 PM.92064 (+0.0000 seconds)
53 48 0D SH.
Answer: 8/2/2012 3:28:24 PM.02964 (+0.1094 seconds)
53 48 0D SH.
Request: 8/2/2012 3:28:24 PM.02964 (+0.0000 seconds)
53 0D S.
Answer: 8/2/2012 3:28:24 PM.13964 (+0.1094 seconds)
53 50 31 39 35 30 34 37 38 34 0D SP19504784.
Request: 8/2/2012 3:28:24 PM.20164 (+0.0000 seconds)
53 48 0D SH.
Answer: 8/2/2012 3:28:24 PM.31164 (+0.1094 seconds)
53 48 0D SH.
Request: 8/2/2012 3:28:24 PM.31164 (+0.0000 seconds)
80 ?
Answer: 8/2/2012 3:28:24 PM.46764 (+0.1563 seconds)
FC ü
Request: 8/2/2012 3:28:24 PM.46764 (+0.0000 seconds)
F1 ñ
Answer: 8/2/2012 3:28:25 PM.84264 (+0.3750 seconds)
8A 31 39 35 30 34 37 38 34 88 ?19504784?
Request: 8/2/2012 3:28:25 PM.90464 (+0.0000 seconds)
F1 ñ
Answer: 8/2/2012 3:28:25 PM.02964 (+0.1250 seconds)
8A 01 41 32 4D 47 30 31 42 B1 ?.A2MG01B±
Request: 8/2/2012 3:28:26 PM.81164 (+0.0000 seconds)
CA F0 00 00 00 00 00 00 00 3A Êð.......:
Answer: 8/2/2012 3:28:26 PM.02964 (+0.2188 seconds)
C4 00 05 00 C9 31 36 38 C4 B7 B7 3F 2E C9 74 5A Ä...É168Ä··?.ÉtZ
02 00 02 00 FE FC C9 A1 0D 07 00 FB FF FD FC C9 ....þüÉ¡...ûÿýüÉ
1E 0E FD FF FE FF FD FC C9 B8 FE 4E FF FA 01 FF ..ýÿþÿýüɸþNÿú.ÿ
FF B9 D0 F9 F0 3F D0 BF 50 9F ÿ¹Ðùð?пP?
You cannot use readline() if the server doesn't send line endings. However, something in the raw protocol has to indicate when a response is complete. This can be one or more of
a specific character sequence
the response to each command ("Request" in your sample) has a known, fixed length
each response contains the length embedded in it at a fixed offset from the start
You will have to do your own buffering and detect the end of each message yourself. Without a detailed description of the protocol being used, that's about as specific an answer as you can expect.
You could try with one of the read method of BufferedReader, and process any breaks in the data yourself. That's probably the best control you'll have.
I'm recompiling a Java program, and I have the following method:
public static native String getMyString(String s);
getMyString is implemented inside mylibrary.so, and looks like follows:
; Scrambler::getMyString(char const*)
EXPORT _ZN9Scrambler18getMyStringEPKc
_ZN9Scrambler18getMyStringEPKc
LDR R1, =(mystring - 0x14FC8)
PUSH {R4-R6,LR}
ADD R1, PC ; "mystring"
MOV R4, R0
BLX strcasecmp
CMP R0, #0
BNE.W loc_150FC
which than ends up in
LDR R5, =(unk_6AE24 - 0x14FD8)
ADD R5, PC
The R5 seems to be the return value here.
The unk_6AE24 looks like follows:
27
68 5D 6D 06 3F 10 6D 26 32 10 56 12 06 3F 32 5D
12 27 26 4B 0D 5D 27 4B 6E 0D 2B 06 32 5D 68 24
3F 32 06 24 70 56 00 63 69 4C 1D 06 5A 7F 0C 34
1E 67 3B 63 32 5F 16 1D 34 5F 1E 32 42 69 18 49
3F 51 49 0C 1F 0C 0E 77 2F 44 69 7F 5A 0C 0B 34
0C 34 1C 24 32 5F 7F 00 00 00 00 1D 30 3B 5F 30
IDA suggests, that the string in question is 27 68 5D 6D or "'h]m", but I'm having my doubts. When I was using c++ ages ago, the strings used to end with 0, which would make for return value of 27 68 5D 6D 06 3F 10 6D 26 32 10 56 12 06 3F 32 5D 12 27 26 4B 0D 5D 27 4B 6E 0D 2B 06 32 5D 68 24 3F 32 06 24 70 56 . Or we could be talking about java string, which may have its own format.
What kind of string will getMyString return?
What kind of string will getMyString return?
It will return a java.lang.String, you can get that from the declaration.
The actual character data will (probably) be one redirection away from that. (a String is probably a pointer to a char array and a size). Keep in mind that in Java, a char is 16 bits.
What are you trying to do, anyway? Much easier to just set a breakpoint right after getMyString returns and look at the return value in a debugger.
The following code snippet attempts to create a Tib DaemonManager connecting to a particular rvd, and then query for that rvd's services.
public static void main(String[] args) throws RuntimeException {
DaemonManager daemonManager = new DaemonManager("http://foo.com:7580");
if(daemonManager.getDaemonType() == DaemonManager.RVD) {
DaemonProxy daemonProxy = daemonManager.getDaemonProxy();
final RvdProxy rvdProxy = (RvdProxy) daemonProxy;
Service[] services = rvdProxy.getServices();
System.out.println(services.length); //prints 0
for (Service service : services) {
System.out.println(service.getNetwork());
}
}
}
This prints zero, even though the web interface for this rvd lists multiple available services. Why might this happen?
The daemon I am connecting to is running v 7.5.1 of the software, and the rvconfig.jar that I am using is from v 7.5.1 as well.
Is there a gotcha when using Tibco's DaemonManager that is causing me to come unstuck?
I used Wireshark to look at the traffic being sent between my RvdProxy and the RVD itself, and it looks like a lot of HTTP GET traffic. For example:
0000 00 1e 0b a4 d1 7c 00 12 d9 7c 8a bf 08 00 45 00 .....|.. .|....E.
0010 03 87 a4 58 40 00 3d 06 66 90 0a 09 14 15 0a 0a ...X#.=. f.......
0020 07 61 1d 9c bf 09 fe 1e d6 82 6e 77 b9 52 80 18 .a...... ..nw.R..
0030 00 1b 05 43 00 00 01 01 08 0a ac 1c 6f 67 07 b2 ...C.... ....og..
0040 86 1f 72 3d 23 30 30 38 30 38 30 3e 3c 66 6f 6e ..r=#008 080><fon
0050 74 20 66 61 63 65 3d 48 65 6c 76 65 74 69 63 61 t face=H elvetica
0060 2c 41 72 69 61 6c 20 73 69 7a 65 3d 32 20 63 6f ,Arial s ize=2 co
0070 6c 6f 72 3d 23 46 46 46 46 46 46 3e 3c 62 3e 43 lor=#FFF FFF><b>C
Sure enough, upon further inspection, it turns out that the requests being made by the proxy are to the web pages served by the Daemon itself - so the proxy API is just a screen-scraper.
But why am I getting no services if they appear on the web pages that are being screen-scraped?
Switch on debugging:
System.setProperty("com.tibco.tibrv.config.debug","classes-to-debug")
And you find that the pattern being used to extract the services from the web-page...
/services,GET~~~~~\
service_detail\\?(\\d+)>\\1</a>.*?size=2>(\\d+\\.\\d+\\.\\d+\\.\\d+)</td>.*?size=2>
(\\d+)</td>.*?size=2>(\\d+)</td>~~~~~\
...fails to match anything! In my case it is because my service networks are not of the form (\\d+\\.\\d+\\.\\d+\\.\\d+) but rather of the form ;(\\d+\\.\\d+\\.\\d+\\.\\d+) - note the leading semicolon. This subtle difference is the source of all of my problems!
This looks like a bug in the rvconfig jar - which needs to be raised with Tibco! :(