servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r683092 - in /servicemix/smx3/branches/servicemix-3.2/deployables: bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/ bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/jca/ bindingcomponents/ser...
Date Wed, 06 Aug 2008 03:03:48 GMT
Author: ffang
Date: Tue Aug  5 20:03:48 2008
New Revision: 683092

URL: http://svn.apache.org/viewvc?rev=683092&view=rev
Log:
[SM-811]servicemix-jms does not set SoapAction property for SOAP jms messages

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/AbstractJmsProcessor.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/jca/JcaProviderProcessor.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingProviderProcessor.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java
    servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiChannel.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/AbstractJmsProcessor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/AbstractJmsProcessor.java?rev=683092&r1=683091&r2=683092&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/AbstractJmsProcessor.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/AbstractJmsProcessor.java
Tue Aug  5 20:03:48 2008
@@ -27,7 +27,9 @@
 import javax.jbi.messaging.NormalizedMessage;
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
 import javax.jms.Message;
+import javax.jms.Queue;
 import javax.jms.Session;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
@@ -59,6 +61,9 @@
     protected SoapHelper soapHelper;
     protected ComponentContext context;
     protected DeliveryChannel channel;
+    protected Session session;
+    protected Destination destination;
+    protected Destination replyToDestination;
 
     protected Store store;
 
@@ -97,6 +102,34 @@
         }
     }
     
+    protected void commonDoStartTasks(InitialContext ctx) throws Exception {
+        channel = endpoint.getServiceUnit().getComponent().getComponentContext().getDeliveryChannel();
+        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        destination = endpoint.getDestination();
+        if (destination == null) {
+            if (endpoint.getJndiDestinationName() != null) {
+                destination = (Destination) ctx.lookup(endpoint.getJndiDestinationName());
+            } else if (endpoint.getJmsProviderDestinationName() != null) {
+                if (STYLE_QUEUE.equals(endpoint.getDestinationStyle())) {
+                    destination = session.createQueue(endpoint.getJmsProviderDestinationName());
+                } else {
+                    destination = session.createTopic(endpoint.getJmsProviderDestinationName());
+                }
+            } else {
+                throw new IllegalStateException("No destination provided");
+            }
+        }
+        if (endpoint.getJndiReplyToName() != null) {
+            replyToDestination = (Destination) ctx.lookup(endpoint.getJndiReplyToName());
+        } else if (endpoint.getJmsProviderReplyToName() != null) {
+            if (destination instanceof Queue) {
+                replyToDestination = session.createQueue(endpoint.getJmsProviderReplyToName());
+            } else {
+                replyToDestination = session.createTopic(endpoint.getJmsProviderReplyToName());
+            }
+        }        
+    }
+    
     protected ConnectionFactory getConnectionFactory(InitialContext ctx) throws NamingException
{
         // First check configured connectionFactory on the endpoint
         ConnectionFactory connectionFactory = endpoint.getConnectionFactory();
@@ -203,5 +236,25 @@
         }
         return response;
     }
+    
+    protected Message createMessageFromExchange(Session session,
+            MessageExchange exchange) throws Exception {
+//        TextMessage msg = session.createTextMessage();
+        NormalizedMessage nm = exchange.getMessage("in");
+        Message msg = fromNMS(nm, session);
+
+        // Build the SoapAction from <interface namespace>/<interface
+        // name>/<operation name>
+        String soapAction = "";
+        if (exchange.getOperation() != null) {
+            String interFaceName = exchange.getInterfaceName() == null ? ""
+                    : exchange.getInterfaceName().getNamespaceURI() + "/"
+                            + exchange.getInterfaceName().getLocalPart();
+            soapAction = interFaceName + "/" + exchange.getOperation();
+        }
+        msg.setStringProperty("SoapAction", soapAction);
+        msg.setStringProperty("SOAPJMS_soapAction", soapAction);
+        return msg;
+    }
 
 }

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/jca/JcaProviderProcessor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/jca/JcaProviderProcessor.java?rev=683092&r1=683091&r2=683092&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/jca/JcaProviderProcessor.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/jca/JcaProviderProcessor.java
Tue Aug  5 20:03:48 2008
@@ -20,7 +20,6 @@
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.InOnly;
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.NormalizedMessage;
 import javax.jbi.messaging.RobustInOnly;
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
@@ -94,8 +93,7 @@
             }
             MessageProducer producer = session.createProducer(destination);
 
-            NormalizedMessage nm = exchange.getMessage("in");
-            Message msg = fromNMS(nm, session);
+            Message msg = createMessageFromExchange(session, exchange);
             producer.send(msg);
         } finally {
             if (session != null) {

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingProviderProcessor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingProviderProcessor.java?rev=683092&r1=683091&r2=683092&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingProviderProcessor.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingProviderProcessor.java
Tue Aug  5 20:03:48 2008
@@ -16,20 +16,17 @@
  */
 package org.apache.servicemix.jms.multiplexing;
 
-import javax.jbi.messaging.DeliveryChannel;
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.InOnly;
 import javax.jbi.messaging.InOut;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.messaging.NormalizedMessage;
 import javax.jbi.messaging.RobustInOnly;
-import javax.jms.Destination;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageListener;
 import javax.jms.MessageProducer;
 import javax.jms.Queue;
-import javax.jms.Session;
 import javax.naming.InitialContext;
 
 import org.apache.servicemix.jms.AbstractJmsProcessor;
@@ -38,43 +35,20 @@
 
 public class MultiplexingProviderProcessor extends AbstractJmsProcessor implements MessageListener
{
 
-    protected Session session;
-    protected Destination destination;
-    protected Destination replyToDestination;
+    
     protected MessageConsumer consumer;
     protected MessageProducer producer;
-    protected DeliveryChannel channel;
+//    protected DeliveryChannel channel;
 
     public MultiplexingProviderProcessor(JmsEndpoint endpoint) throws Exception {
         super(endpoint);
     }
-
+   
     protected void doStart(InitialContext ctx) throws Exception {
-        channel = endpoint.getServiceUnit().getComponent().getComponentContext().getDeliveryChannel();
-        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        destination = endpoint.getDestination();
-        if (destination == null) {
-            if (endpoint.getJndiDestinationName() != null) {
-                destination = (Destination) ctx.lookup(endpoint.getJndiDestinationName());
-            } else if (endpoint.getJmsProviderDestinationName() != null) {
-                if (STYLE_QUEUE.equals(endpoint.getDestinationStyle())) {
-                    destination = session.createQueue(endpoint.getJmsProviderDestinationName());
-                } else {
-                    destination = session.createTopic(endpoint.getJmsProviderDestinationName());
-                }
-            } else {
-                throw new IllegalStateException("No destination provided");
-            }
-        }
-        if (endpoint.getJndiReplyToName() != null) {
-            replyToDestination = (Destination) ctx.lookup(endpoint.getJndiReplyToName());
-        } else if (endpoint.getJmsProviderReplyToName() != null) {
-            if (destination instanceof Queue) {
-                replyToDestination = session.createQueue(endpoint.getJmsProviderReplyToName());
-            } else {
-                replyToDestination = session.createTopic(endpoint.getJmsProviderReplyToName());
-            }
-        } else {
+//        channel = endpoint.getServiceUnit().getComponent().getComponentContext().getDeliveryChannel();
+        commonDoStartTasks(ctx);
+        //Create temp destination of no reply destination found.
+        if (endpoint.getJndiReplyToName() == null && endpoint.getJmsProviderReplyToName()
== null) {
             if (destination instanceof Queue) {
                 replyToDestination = session.createTemporaryQueue();
             } else {    
@@ -132,8 +106,8 @@
         } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
             return;
         }
-        NormalizedMessage nm = exchange.getMessage("in");
-        Message msg = fromNMS(nm, session);
+        
+        Message msg = createMessageFromExchange(session, exchange);
 
         if (exchange instanceof InOnly || exchange instanceof RobustInOnly) {
             synchronized (producer) {

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java?rev=683092&r1=683091&r2=683092&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java
Tue Aug  5 20:03:48 2008
@@ -19,7 +19,6 @@
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 
-import javax.jbi.messaging.DeliveryChannel;
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.InOnly;
 import javax.jbi.messaging.InOut;
@@ -42,45 +41,14 @@
 import org.apache.servicemix.soap.marshalers.SoapMessage;
 
 public class StandardProviderProcessor extends AbstractJmsProcessor {
-
-    protected Destination destination;
-    protected Destination permanentReplyToDestination;
-    protected DeliveryChannel channel;
     
     public StandardProviderProcessor(JmsEndpoint endpoint) throws Exception {
         super(endpoint);
     }
 
     protected void doStart(InitialContext ctx) throws Exception {
-        channel = endpoint.getServiceUnit().getComponent().getComponentContext().getDeliveryChannel();
-        Session session = null;
-        destination = endpoint.getDestination();
         try {
-            if (destination == null) {
-                session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-                if (endpoint.getJndiDestinationName() != null) {
-                    destination = (Destination) ctx.lookup(endpoint.getJndiDestinationName());
-                } else if (endpoint.getJmsProviderDestinationName() != null) {
-                    if (STYLE_QUEUE.equals(endpoint.getDestinationStyle())) {
-                        destination = session.createQueue(endpoint.getJmsProviderDestinationName());
-                    } else {
-                        destination = session.createTopic(endpoint.getJmsProviderDestinationName());
-                    }
-                } else {
-                    throw new IllegalStateException("No destination provided");
-                }
-
-                if (endpoint.getJndiReplyToName() != null) {
-                    permanentReplyToDestination = (Destination) ctx.lookup(endpoint.getJndiReplyToName());
-                } else if (endpoint.getJmsProviderReplyToName() != null) {
-                    if (destination instanceof Queue) {
-                        permanentReplyToDestination = session.createQueue(endpoint.getJmsProviderReplyToName());
-                    } else {
-                        permanentReplyToDestination = session.createTopic(endpoint.getJmsProviderReplyToName());
-                    }
-                }
-            }
+            commonDoStartTasks(ctx);
         } finally {
             if (session != null) {
                 session.close();
@@ -104,27 +72,26 @@
 
             MessageProducer producer = session.createProducer(destination);
             
-            NormalizedMessage nm = exchange.getMessage("in");
-            Message msg = fromNMS(nm, session);
+            Message msg = createMessageFromExchange(session, exchange);
     
             if (exchange instanceof InOnly || exchange instanceof RobustInOnly) {
                 producer.send(msg);
                 exchange.setStatus(ExchangeStatus.DONE);
                 channel.send(exchange);
             } else if (exchange instanceof InOut) {
-                Destination replyToDestination;
-                if (permanentReplyToDestination != null) {
-                    replyToDestination = permanentReplyToDestination;
+                Destination replyDestination;
+                if (replyToDestination != null) {
+                    replyDestination = replyToDestination;
                 } else {
                     if (destination instanceof Queue) {
-                        replyToDestination = session.createTemporaryQueue();
+                        replyDestination = session.createTemporaryQueue();
                     } else {
-                        replyToDestination = session.createTemporaryTopic();
+                        replyDestination = session.createTemporaryTopic();
                     }
                 }
-                MessageConsumer consumer = session.createConsumer(replyToDestination);
+                MessageConsumer consumer = session.createConsumer(replyDestination);
                 msg.setJMSCorrelationID(exchange.getExchangeId());
-                msg.setJMSReplyTo(replyToDestination);
+                msg.setJMSReplyTo(replyDestination);
                 producer.send(msg);
                 Message message = consumer.receive();
                 if (message instanceof ObjectMessage) {

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiChannel.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiChannel.java?rev=683092&r1=683091&r2=683092&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiChannel.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiChannel.java
Tue Aug  5 20:03:48 2008
@@ -119,6 +119,7 @@
                         msg.setSecuritySubject(oldMsg.getSecuritySubject());
                     }
                 }
+                me.setOperation(context.getExchange().getOperation().getQName());
                 msg.setContent(getContent(context, message));
                 if (!channel.sendSync(me)) {
                     throw new XFireException("Unable to send jbi exchange: sendSync returned
false");



Mime
View raw message