Hi Joel,
I had discussion with my client and as per discussion, based on MTI code they should receive response.
I have followed below process.
Steps:
1. created VSM and VSI by selecting TCP as transport protocol and without selecting any DPH using RR pairs which are in HEX format.
2. Edited VSM by adding Scriptable data Protocol and added below script to convert the HEX to String.
import com.itko.util.ParameterList;
import com.itko.util.Parameter;
// Manipulate request body text
String theBody = lisa_vse_request.getBodyText();
theBody = theBody.replaceAll("[^a-zA-Z0-9 ]","").replaceAll("\\s","");
StringBuilder output = new StringBuilder();
for (int i = 0; i < theBody.length(); i+=2) {
String str = theBody.substring(i, i+2);
// Remove spl char and space
output.append((char)Integer.parseInt(str, 16));
output.tostring().replaceAll("[^a-zA-Z0-9 ]","").replaceAll("\\s","");
}
String hex2 = output.toString().replaceAll("[^a-zA-Z0-9 ]","").replaceAll("\\s","").substring(00, 04);
hex2.addParameter(new Parameter("MTI_Code", MTI));
lisa_vse_request.setArguments(hex2);
3. added Argument key value pair in VSI. Argument name as "MTI" and value "0200"
4. deployed on port#.
I have below Questions:
1. Is it correct approach?
2. How to test TCP calls.
could you please guide me to complete this project?
Also I have tried to hit the service by using java code.
public static void TCPclientcall(String outputString) throws IOException,ClassNotFoundException, InterruptedException {
// System.out.println(outputString);
try {
//InetAddress host = InetAddress.getLocalHost();
Socket socket = null;
socket = new Socket("localhost", 9876);
ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
if(outputString!=""|outputString!=null){
oos.writeObject(outputString);
}
String message = (String) ois.readObject();
System.out.println("TCP Response Message:" + message);
ois.close();
oos.close();
socket.close();
Thread.sleep(100);
} catch (IOException e) {
e.printStackTrace();
}
Thanks,
Venu