geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r504879 - /geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
Date Thu, 08 Feb 2007 13:09:47 GMT
Author: dims
Date: Thu Feb  8 05:09:47 2007
New Revision: 504879

URL: http://svn.apache.org/viewvc?view=rev&rev=504879
Log:
Fix for (GERONIMO-2811) got runtimeexception when processing soap request in doservice2

Modified:
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?view=diff&rev=504879&r1=504878&r2=504879
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
Thu Feb  8 05:09:47 2007
@@ -51,6 +51,7 @@
 import org.apache.axis2.description.AxisMessage;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.description.TransportOutDescription;
@@ -393,17 +394,8 @@
         String path = uri.getPath();
         String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
         
-        HashMap services = configurationContext.getAxisConfiguration().getServices();
-        AxisService service = null;
-        String serviceName = null;
-        
-        if(services.size() == 1){
-        	service = (AxisService)(services.values().iterator().next());
-        	serviceName = (String)(services.keySet().iterator().next());
-        }else { // can't be happen
-        	log.error("Invalid service configurations ");
-        	throw new RuntimeException("Invalid Configuration");
-        }
+        AxisService service = findServiceWithEndPointClassName(configurationContext, endpointClassName);
+        String serviceName = service.getName();
 
         // TODO: Port this section
 //        // Adjust version and content chunking based on the config
@@ -562,6 +554,37 @@
     
     public void destroy() {
 	}
+    
+    /**
+     * Resolves the Axis Service associated with the endPointClassName
+     * @param cfgCtx
+     * @param endPointClassName
+     */
+    private AxisService findServiceWithEndPointClassName(ConfigurationContext cfgCtx, String
endPointClassName) {
+
+        // Visit all the AxisServiceGroups.
+        Iterator svcGrpIter = cfgCtx.getAxisConfiguration().getServiceGroups();
+        while (svcGrpIter.hasNext()) {
+
+            // Visit all the AxisServices
+            AxisServiceGroup svcGrp = (AxisServiceGroup) svcGrpIter.next();
+            Iterator svcIter = svcGrp.getServices();
+            while (svcIter.hasNext()) {
+                AxisService service = (AxisService) svcIter.next();
+
+                // Grab the Parameter that stores the ServiceClass.
+                String epc = (String)service.getParameter("ServiceClass").getValue();
+                
+                if (epc != null) {
+                    // If we have a match, then just return the AxisService now.
+                    if (endPointClassName.equals(epc)) {
+                        return service;
+                    }
+                }
+            }
+        }
+        return null;
+    }    
     
     public class Axis2TransportInfo implements OutTransportInfo {
         private Response response;



Mime
View raw message