axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r381059 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java core/src/org/apache/axis2/engine/InstanceDispatcher.java
Date Sun, 26 Feb 2006 05:32:40 GMT
Author: chinthaka
Date: Sat Feb 25 21:32:35 2006
New Revision: 381059

URL: http://svn.apache.org/viewcvs?rev=381059&view=rev
Log:
moving sgcId extraction from the addressing in handler to instance dipatcher, the correct
place.

Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/InstanceDispatcher.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=381059&r1=381058&r2=381059&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
Sat Feb 25 21:32:35 2006
@@ -23,11 +23,9 @@
 import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceGroupContext;
 import org.apache.axis2.i18n.Messages;
 import org.apache.ws.commons.om.OMAbstractFactory;
 import org.apache.ws.commons.om.OMAttribute;
-import org.apache.ws.commons.om.OMElement;
 import org.apache.ws.commons.soap.SOAP12Constants;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.ws.commons.soap.SOAPFaultReason;
@@ -69,9 +67,6 @@
                 logger.debug("No Headers present corresponding to " + addressingVersion);
             }
 
-            // extract service group context, if available
-            extractServiceGroupContextId(header, msgContext);
-
         } catch (AddressingException e) {
             logger.info("Exception occurred in Addressing Module");
             throw new AxisFault(e);
@@ -137,21 +132,6 @@
     }
 
     protected abstract void extractToEprReferenceParameters(EndpointReference toEPR, SOAPHeader
header);
-
-    private void extractServiceGroupContextId(SOAPHeader header, MessageContext msgContext)
throws AxisFault {
-        OMElement serviceGroupId = header.getFirstChildWithName(new QName(Constants.AXIS2_NAMESPACE_URI,
-                Constants.SERVICE_GROUP_ID, Constants.AXIS2_NAMESPACE_PREFIX));
-        if (serviceGroupId != null) {
-            String groupId = serviceGroupId.getText();
-            ServiceGroupContext serviceGroupContext = msgContext.getConfigurationContext().
-                    getServiceGroupContext(groupId, msgContext);
-            if (serviceGroupContext == null) {
-//                handleNoServiceGroupContextIDCase(msgContext);
-                throw new AxisFault("Invalid Service Group Id." + groupId);
-            }
-            msgContext.setServiceGroupContextId(serviceGroupId.getText());
-        }
-    }
 
     private void handleNoServiceGroupContextIDCase(MessageContext msgContext) {
         SOAPFactory soapFac = msgContext.isSOAP11() ? OMAbstractFactory.getSOAP11Factory()
: OMAbstractFactory.getSOAP12Factory();

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/InstanceDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/InstanceDispatcher.java?rev=381059&r1=381058&r2=381059&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/InstanceDispatcher.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/InstanceDispatcher.java
Sat Feb 25 21:32:35 2006
@@ -19,10 +19,18 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.context.*;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.context.SessionContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.soap.SOAPHeader;
+
+import javax.xml.namespace.QName;
 
 /**
  * By the time the control comes to this handler, the dispatching must have happened
@@ -51,6 +59,10 @@
 
             return;
         }
+
+        // try to extract sgcId from the message
+        extractServiceGroupContextId(msgContext);
+        
         //trying to get service context from Session context
         fillContextsFromSessionContext(msgContext);
 
@@ -128,6 +140,25 @@
                 msgContext.setServiceContext(serviceContext);
             }
         }
+    }
+
+    private void extractServiceGroupContextId(MessageContext msgContext) throws AxisFault
{
+        SOAPHeader soapHeader = msgContext.getEnvelope().getHeader();
+        if (soapHeader != null) {
+            OMElement serviceGroupId = soapHeader.getFirstChildWithName(new QName(Constants.AXIS2_NAMESPACE_URI,
+                    Constants.SERVICE_GROUP_ID, Constants.AXIS2_NAMESPACE_PREFIX));
+            if (serviceGroupId != null) {
+                String groupId = serviceGroupId.getText();
+                ServiceGroupContext serviceGroupContext = msgContext.getConfigurationContext().
+                        getServiceGroupContext(groupId, msgContext);
+                if (serviceGroupContext == null) {
+//                handleNoServiceGroupContextIDCase(msgContext);
+                    throw new AxisFault("Invalid Service Group Id." + groupId);
+                }
+                msgContext.setServiceGroupContextId(serviceGroupId.getText());
+            }
+        }
+
     }
 
 }



Mime
View raw message