ActiveMQTopic pubTopic = new ActiveMQTopic("demo.org.servicemix.source");
System.out.println("Connecting to JMS server.");
TopicConnection connection = factory.createTopicConnection();
TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
connection.start();
TopicRequestor requestor = new TopicRequestor(session, pubTopic);
System.out.println("Sending request.");
String payload = "";
BufferedReader reader = new BufferedReader(new FileReader("message.soap"));
String str = null;
while ((str = reader.readLine()) != null) {
payload += str;
}
Message out = session.createTextMessage(payload);
Message in = requestor.request(out);
if (in == null) {
System.out.println("Response timed out.");
}
else {
System.out.println("Response was: " + in);