connection = (MQQueueConnection) mqQueueConnectionFactory.createQueueConnection();
MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
MQQueue queue = (MQQueue) session.createQueue("queue:///" + requestQueueName);
MQQueue responseQueue = (MQQueue) session.createQueue("queue:///" + responeQueueName);
MQQueueSender sender = (MQQueueSender) session.createSender(queue);
MQQueueReceiver receiver = (MQQueueReceiver) session.createReceiver(responseQueue);
isConnected = true;
System.out.println("-------- preparing request to send: ");
String messageString = requestString;
JMSTextMessage message = (JMSTextMessage) session.createTextMessage(messageString);
message.setJMSType("XML/MQ");
// message.setJMSReplyTo(responseQueue);
connection.start();
sender.send(message);
JMSMessage receivedMessage = (JMSMessage) receiver.receive(TIMEOUT);
System.out.println("-------- recieved JMSMessage is: \n" + receivedMessage);
sender.close();
receiver.close();
session.close();
connection.close();
System.out.println("-------- getting response: ");
responseXMLString = receivedMessage != null ? ((JMSTextMessage) receivedMessage).getText() : "No response recieved. Timed Out";