To test the TIP Transaction, pass input parameter in byte array format for initiating a transaction, The transaction output is generated in byte array format. You can use the auto generated TIP wrapper class for parsing the transaction output values and for viewing it.
You can use any one of the following examples to set input parameter for the TIP transaction:
To set the input transaction parameter using default encoding technique:
String input = "<enter the transaction input here>";
byte[] txInput = input.getBytes();
byte[] txOutput = tx.callTrans(txInput);
To set the input transaction parameter using character encoding technique:
String input = "<enter the transaction input here>";
byte[] txInput = CharTypeUtil.tipCharEncoder(input2, CharType.United_Kingdom).array();
byte[] txOutput = tx.callTrans(txInput);
Note: Replace "<enter the transaction input here>" with the TIP input transaction parameter.
You can use any one of the following examples to parse output parameter for the TIP transaction:
To parse the output transaction parameter using default encoding technique:
byte[] txOutput = tx.callTrans(txInput);
TipAllDataBufferWrapper wrap = new TipAllDataBufferWrapper(txOutput);
System.out.print(wrap.getBuffer());
System.out.println(wrap.getPlant());
To parse the output transaction parameter using character encoding technique:
TipAllDataBufferWrapper wrap1 = new TipAllDataBufferWrapper(txOutput,CharType.United_Kingdom);
System.out.print(wrap1.getBuffer());
byte[] plantBytes = wrap1.getPlant(CharType.United_Kingdom);
String plant = new String(plantBytes,0,5);
System.out.println(plant);
You can use any one of the following examples to use the user defined values in wrapper classes:
To set and get the user defined values with default encoding:
TipAllDataBufferWrapper wrap2 = new TipAllDataBufferWrapper();
wrap2.setPlant("Delhi");
System.out.println(wrap2.getPlant());
To set and get the user defined values with character encoding:
TipAllDataBufferWrapper wrap3 = new TipAllDataBufferWrapper();
String str = "Texas";
byte[] strBytes = CharTypeUtil.tipCharEncoder(str, CharType.United_Kingdom).array();
wrap3.setPlant(strBytes, CharType.United_Kingdom);
System.out.println(new String(wrap3.getPlant(CharType.United_Kingdom),0,5));
Note: Modify the ra.xml file to change the OS 2200 Host name and CITA port details.