i have used SOAP over JMS with TIBCO EMS Server; i would like to do the same
with JBOSS Messaging in AS 5.0.1
below is the client code for an example of what i am trying to do
thanx,
matt
|
|
| import javax.jms.JMSException;
| import javax.jms.MessageProducer;
| import javax.jms.Queue;
| import javax.jms.QueueConnection;
| import javax.jms.QueueConnectionFactory;
| import javax.jms.QueueReceiver;
| import javax.jms.QueueSession;
| import javax.jms.TextMessage;
|
| public class SoapOverJmsClient
| {
| public static final String SOAP_REQUEST = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><soapenv:Envelope
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:ns0=\"http://www.pyxisengineering.com/Quote/\"><soapenv:Header/><soapenv:Body><ns0:GetAll><symbol>tibx</symbol></ns0:GetAll></soapenv:Body></soapenv:Envelope>";
| public static final String REQUEST_JMS_QUEUE_NAME = "queue.sample";
| public static final String REPLY_TO_JMS_QUEUE_NAME = "queue.sample";
|
| public static void main(String[] args)
| {
|
| String inputValue = "tibx";
| SoapOverJmsClient.sendJMS(inputValue);
|
| }//end SoapOverJmsClient entry point
|
| public static void sendJMS(String inputValue)
| {
| //receiving reply from the queue.
| try
| {
| //create the queues
| QueueConnectionFactory factory = new
com.tibco.tibjms.TibjmsQueueConnectionFactory("localhost");
| QueueConnection connection =
factory.createQueueConnection(null, null);
| QueueSession session =
connection.createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
| Queue requestQueue =
session.createQueue(SoapOverJmsClient.REQUEST_JMS_QUEUE_NAME);
| javax.jms.Queue replyToQueue =
session.createQueue(SoapOverJmsClient.REPLY_TO_JMS_QUEUE_NAME);
|
| //build jms message
| MessageProducer sender = session.createSender(requestQueue);
| TextMessage txtMsg = session.createTextMessage();
| txtMsg.setStringProperty("SoapAction", "\"GetAll\"");
| txtMsg.setStringProperty("Mime_Version", "1.0");
| txtMsg.setStringProperty("Content_Type", "application/xml;
charset=\"utf-8\"");
| txtMsg.setText(SoapOverJmsClient.SOAP_REQUEST);
|
| //set the reply queue
| txtMsg.setJMSReplyTo(replyToQueue);
|
| //send message
| sender.send(txtMsg);
|
|
| //use createQueue() to enable receiving from dynamic queues.
| QueueReceiver receiver = session.createReceiver(replyToQueue);
|
| //start the connection to receive from queue
| connection.start();
|
| //read queue messages
| javax.jms.Message message = receiver.receive(10000);
| if(message != null)
| System.out.println("Received message: " + message);
| else
| System.out.println("Error while retriving message");
| connection.close();
| }
| catch(JMSException jmse)
| {
| jmse.printStackTrace();
| System.exit(0);
|
| }//end catch jmse
|
| }//end static sendJMS
|
| }//end class SoapOverJmsClient
|
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224776#4224776
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224776
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user