You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/06/28 08:18:23 UTC

svn commit: r417681 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: engine/AxisEngine.java util/Utils.java

Author: deepal
Date: Tue Jun 27 23:18:23 2006
New Revision: 417681

URL: http://svn.apache.org/viewvc?rev=417681&view=rev
Log:
moved transport logic to AbstractMessage receiver , considering Chamikara's use case

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=417681&r1=417680&r2=417681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java Tue Jun 27 23:18:23 2006
@@ -617,33 +617,6 @@
             // write the Message to the Wire
             TransportOutDescription transportOut = msgContext.getTransportOut();
             TransportSender sender = transportOut.getSender();
-            
-            //there may be instance where you want to send the response to replyTo
-            //and this default behaviour should happen if somebody (e.g. a module) has not already provided
-            //a Sender.
-            if (msgContext.isServerSide() && msgContext.getTo() != null) {
-                try {
-                    String replyToAddress = msgContext.getTo().getAddress();
-                    if (!(AddressingConstants.Final.WSA_ANONYMOUS_URL.equals(replyToAddress)
-                            || AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals(replyToAddress))) {
-                        URI uri = new URI(replyToAddress);
-                        String scheme = uri.getScheme();
-                        if (!transportOut.getName().getLocalPart().equals(scheme)) {
-                            ConfigurationContext configurationContext = msgContext.getConfigurationContext();
-                            transportOut = configurationContext.getAxisConfiguration()
-                                    .getTransportOut(new QName(scheme));
-                            if (transportOut == null) {
-                                throw new AxisFault("Can not find the transport sender : " + scheme);
-                            }
-                            sender = transportOut.getSender();
-                        }
-                    }
-                    //
-                } catch (URISyntaxException e) {
-                    log.info("error in infer transport from replyTo address");
-                }
-            }
-
             // This boolean property only used in client side fireAndForget invocation
             //It will set a property into message context and if some one has set the
             //property then transport sender will invoke in a diffrent thread

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java?rev=417681&r1=417680&r2=417681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java Tue Jun 27 23:18:23 2006
@@ -18,32 +18,15 @@
 package org.apache.axis2.util;
 
 import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPFaultCode;
-import org.apache.axiom.soap.SOAPFaultSubCode;
-import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.*;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.client.Options;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.Flow;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.description.OutInAxisOperation;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.PhaseRule;
+import org.apache.axis2.context.*;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisError;
 import org.apache.axis2.engine.Handler;
@@ -51,10 +34,13 @@
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.receivers.AbstractMessageReceiver;
 import org.apache.axis2.receivers.RawXMLINOutMessageReceiver;
+import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
 import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.HashMap;
 import java.util.Iterator;
 
@@ -69,7 +55,7 @@
         flow.addHandler(handlerDesc);
     }
 
-    public static MessageContext createOutMessageContext(MessageContext inMessageContext) {
+    public static MessageContext createOutMessageContext(MessageContext inMessageContext) throws AxisFault {
         MessageContext newmsgCtx = new MessageContext();
 
         newmsgCtx.setConfigurationContext(inMessageContext.getConfigurationContext());
@@ -115,6 +101,34 @@
         newmsgCtx.setServerSide(inMessageContext.isServerSide());
         newmsgCtx.setServiceGroupContextId(inMessageContext.getServiceGroupContextId());
 
+        // write the Message to the Wire
+        TransportOutDescription transportOut = newmsgCtx.getTransportOut();
+        TransportSender sender = transportOut.getSender();
+
+        //there may be instance where you want to send the response to replyTo
+        //and this default behaviour should happen if somebody (e.g. a module) has not already provided
+        //a Sender.
+        try {
+            if (newmsgCtx.isServerSide() && newmsgCtx.getTo() != null) {
+                String replyToAddress = newmsgCtx.getTo().getAddress();
+                if (!(AddressingConstants.Final.WSA_ANONYMOUS_URL.equals(replyToAddress)
+                        || AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals(replyToAddress))) {
+                    URI uri = new URI(replyToAddress);
+                    String scheme = uri.getScheme();
+                    if (!transportOut.getName().getLocalPart().equals(scheme)) {
+                        ConfigurationContext configurationContext = newmsgCtx.getConfigurationContext();
+                        transportOut = configurationContext.getAxisConfiguration()
+                                .getTransportOut(new QName(scheme));
+                        if (transportOut == null) {
+                            throw new AxisFault("Can not find the transport sender : " + scheme);
+                        }
+                        newmsgCtx.setTransportOut(transportOut);
+                    }
+                }
+            }
+        } catch (URISyntaxException e) {
+            throw new AxisFault(e);
+        }
         return newmsgCtx;
     }
 
@@ -383,39 +397,39 @@
     }
 
     /**
-         * Maps the String URI of the Message exchange pattern to a integer.
-         * Further, in the first lookup, it will cache the looked
-         * up value so that the subsequent method calls are extremely efficient.
-         */
-        public static int getAxisSpecifMEPConstant(String messageExchangePattern) {
-
-
-            int mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_INVALID;
-
-            if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT.equals(messageExchangePattern)) {
-                mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_IN_OUT;
-            } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(messageExchangePattern)) {
-                mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_IN_ONLY;
-            } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT.equals(messageExchangePattern)) {
-                mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_IN_OPTIONAL_OUT;
-            } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_IN.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_IN.equals(messageExchangePattern)) {
-                mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_OUT_IN;
-            } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_ONLY.equals(messageExchangePattern)) {
-                mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_OUT_ONLY;
-            } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN.equals(messageExchangePattern)) {
-                mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_OUT_OPTIONAL_IN;
-            } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY.equals(messageExchangePattern)) {
-                mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_ROBUST_IN_ONLY;
-            } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY.equals(messageExchangePattern)) {
-                mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_ROBUST_OUT_ONLY;
-            }
+     * Maps the String URI of the Message exchange pattern to a integer.
+     * Further, in the first lookup, it will cache the looked
+     * up value so that the subsequent method calls are extremely efficient.
+     */
+    public static int getAxisSpecifMEPConstant(String messageExchangePattern) {
 
-            if (mepConstant == WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_INVALID) {
-                throw new AxisError(Messages.getMessage("mepmappingerror"));
-            }
 
+        int mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_INVALID;
 
-            return mepConstant;
+        if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT.equals(messageExchangePattern)) {
+            mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_IN_OUT;
+        } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(messageExchangePattern)) {
+            mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_IN_ONLY;
+        } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT.equals(messageExchangePattern)) {
+            mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_IN_OPTIONAL_OUT;
+        } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_IN.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_IN.equals(messageExchangePattern)) {
+            mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_OUT_IN;
+        } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_ONLY.equals(messageExchangePattern)) {
+            mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_OUT_ONLY;
+        } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN.equals(messageExchangePattern)) {
+            mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_OUT_OPTIONAL_IN;
+        } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY.equals(messageExchangePattern)) {
+            mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_ROBUST_IN_ONLY;
+        } else if (WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(messageExchangePattern) || WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY.equals(messageExchangePattern)) {
+            mepConstant = WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_ROBUST_OUT_ONLY;
         }
+
+        if (mepConstant == WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_INVALID) {
+            throw new AxisError(Messages.getMessage("mepmappingerror"));
+        }
+
+
+        return mepConstant;
+    }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org