Author: nadiramra
Date: Wed Nov  9 17:01:45 2011
New Revision: 1199848

URL: http://svn.apache.org/viewvc?rev=1199848&view=rev
Log:
AXIS2-4440 excludeOperations with static WSDL does not work

Modified:
    
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
    
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java
    
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java

Modified: 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=1199848&r1=1199847&r2=1199848&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
 Wed Nov  9 17:01:45 2011
@@ -409,6 +409,7 @@ public class ServiceBuilder extends Desc
 
                        for (String opName : excludeops) {
                                service.removeOperation(new QName(opName));
+                               service.addExcludeOperationName(opName);
                        }
 
                        // Need to call the same logic towice

Modified: 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=1199848&r1=1199847&r2=1199848&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java
 Wed Nov  9 17:01:45 2011
@@ -256,8 +256,11 @@ public class AxisService extends AxisDes
         private CopyOnWriteArrayList<MessageContextListener> 
messageContextListeners = 
             new CopyOnWriteArrayList<MessageContextListener>();
 
-        // names list keep to preserve the parameter order
-        private List operationsNameList;
+    // names list keep to preserve the parameter order
+    private List operationsNameList;
+    
+    // Excluded operations name list to know which operations to exclude.
+    private List excludeOperationsNameList;
 
        private String[] eprs;
        private boolean customWsdl = false;
@@ -325,6 +328,7 @@ public class AxisService extends AxisDes
                super();
                this.operationsAliasesMap = new HashMap();
                this.invalidOperationsAliases = new ArrayList();
+               this.excludeOperationsNameList = new ArrayList();
                moduleConfigmap = new HashMap();
                // by default service scope is for the request
                scope = Constants.SCOPE_REQUEST;
@@ -597,6 +601,36 @@ public class AxisService extends AxisDes
                moduleRefs.add(moduleref);
        }
 
+    /**
+     * Adds operation name to exclude list.
+     * 
+     * @param operation operation name to add to exclude list
+     * 
+     */
+    public void addExcludeOperationName(String operation){        
+        excludeOperationsNameList.add(operation);       
+    }
+    
+    /**
+     * Removes operation name from exclude list.
+     * 
+     * @param operation operation name to remove from exclude list
+     * 
+     */
+    public void removeExcludeOperationName(String operation){        
+        excludeOperationsNameList.remove(operation);       
+    }
+    
+    /**
+     * Returns whether operation name is in exclude list. 
+     * 
+     * @param operation name to check if operation is in the exlude list.
+     * @return boolean indicating whether operation name is in exlude list. 
+     */
+    public boolean isExcludedOperation(String operation){        
+        return excludeOperationsNameList.contains(operation);       
+    }
+       
        /*
         * (non-Javadoc)
         * 

Modified: 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java?rev=1199848&r1=1199847&r2=1199848&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java
 Wed Nov  9 17:01:45 2011
@@ -83,6 +83,21 @@ public class DispatchPhase extends Phase
 
         AxisService service = msgContext.getAxisService();
         AxisOperation operation = msgContext.getAxisOperation();
+        
+        // If operation is an excluded operation, throw an exception.
+        // This code is needed to enable exclude operations for static WSDL 
files. 
+        // Without this code, if one specifies excludeOperations in 
services.xml
+        // file and a static WSDL is used that contains the operation, 
+        // the operation would succeed.
+        if (operation != null 
+                && 
service.isExcludedOperation(operation.getName().getLocalPart())) {
+            AxisFault fault = new 
AxisFault(Messages.getMessage("operationnotfoundforepr2",
+                    ((toEPR != null) ? toEPR.getAddress()
+                            : ""), msgContext.getWSAAction()));
+            
fault.setFaultCode(org.apache.axis2.namespace.Constants.FAULT_CLIENT);
+            throw fault;
+        }
+
         // If we're configured to do so, check the service for a single op...
         if (operation == null &&
                 
JavaUtils.isTrue(service.getParameterValue(AxisService.SUPPORT_SINGLE_OP))) {


Reply via email to