[prev in list] [next in list] [prev in thread] [next in thread] 

List:       axis-dev
Subject:    svn commit: r819156 - in /webservices/axis2/trunk/java/modules/metadata: ./
From:       woodroy () apache ! org
Date:       2009-09-26 15:42:55
Message-ID: 20090926154256.2DAE7238889C () eris ! apache ! org
[Download RAW message or body]

Author: woodroy
Date: Sat Sep 26 15:42:55 2009
New Revision: 819156

URL: http://svn.apache.org/viewvc?rev=819156&view=rev
Log:
Support new SUN 1.6 behavior concerning processing of @WebMethod annotations

Added:
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/MethodRetriever.java
  webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/LegacyMethodRetrieverImpl.java
  webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/PostRI216MethodRetrieverImpl.java
  webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSToolingUtils.java
 Modified:
    webservices/axis2/trunk/java/modules/metadata/pom.xml
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java
  webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
  webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
  webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
  webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointInterfaceDescriptionValidator.java
  webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
  webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/ValidateWSDLTests.java


Modified: webservices/axis2/trunk/java/modules/metadata/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/pom.xml?rev=819156&r1=819155&r2=819156&view=diff
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/metadata/pom.xml Sat Sep 26 15:42:55 2009
@@ -79,6 +79,21 @@
             </exclusions>
         </dependency>
         <dependency>
+            <groupId>com.sun.xml.ws</groupId>
+            <artifactId>jaxws-tools</artifactId>
+            <version>2.1.3</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.sun.xml.ws</groupId>
+                    <artifactId>jaxws-rt</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.sun.xml.bind</groupId>
+                    <artifactId>jaxb-xjc</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
             <groupId>org.apache.axis2</groupId>
             <artifactId>axis2-transport-http</artifactId>
             <version>${version}</version>

Added: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/MethodRetriever.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/MethodRetriever.java?rev=819156&view=auto
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/MethodRetriever.java \
                (added)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/MethodRetriever.java \
Sat Sep 26 15:42:55 2009 @@ -0,0 +1,276 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.description;
+
+import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
+import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
+import org.apache.axis2.jaxws.description.impl.DescriptionUtils;
+import org.apache.axis2.jaxws.description.impl.EndpointInterfaceDescriptionImpl;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A MethodRetriever is an abstract class which is meant to be sub-classed for each \
type of  + * method retrieval behavior. The catalyst for this was the introduction of \
new spec. + * interpretation by SUN RI. 
+ * 
+ *  Please refer to the following links:
+ *  
+ *  
+ *     https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577 
+ *     http://forums.java.net/jive/thread.jspa?threadID=61630
+ *     http://forums.java.net/jive/thread.jspa?threadID=55078 
+ *
+ *  This base is being used to allow for a cleaner componentization of the old/new \
and potential + *  future behavior changes.
+ *  
+ *  The sub-class is required to implement only the abstract 'retrieveMethods' 
+ * 
+ */
+
+public abstract class MethodRetriever {
+
+    //Logging setup
+    private static final Log log = LogFactory.getLog(MethodRetriever.class);
+    
+    protected MethodRetriever() {}
+
+    /*
+     * Returns a non-null (possibly empty) list of MethodDescriptionComposites
+     */
+    public abstract Iterator<MethodDescriptionComposite> retrieveMethods();
+
+
+    /**
+     * A recursive method which peruses and retrieves methods in the super class \
hierarchy +     * @param tmpDBC
+     * @param eid
+     * @return
+     */
+    protected ArrayList<MethodDescriptionComposite> retrieveSEIMethodsChain(
+        DescriptionBuilderComposite tmpDBC, EndpointInterfaceDescriptionImpl eid) {
+
+        DescriptionBuilderComposite dbc = tmpDBC;
+        ArrayList<MethodDescriptionComposite> retrieveList = new \
ArrayList<MethodDescriptionComposite>(); +
+        retrieveList = retrieveSEIMethods(dbc);
+
+        //Since this is an interface, anything that is in the extends clause will \
actually appear +        // in the interfaces list instead.
+        Iterator<String> iter = null;
+        List<String> interfacesList = dbc.getInterfacesList();
+        if (interfacesList != null) {
+            iter = dbc.getInterfacesList().iterator();
+
+            while (iter.hasNext()) {
+
+                String interfaceName = iter.next();
+                DescriptionBuilderComposite superInterface = 
+                    \
eid.getEndpointDescriptionImpl().getServiceDescriptionImpl().getDBCMap().get(interfaceName);
 +
+                retrieveList.addAll(retrieveSEIMethodsChain(superInterface, eid));
+            }
+        }
+
+        return retrieveList;
+    }
+
+    /**
+     * This method will loop through each method that was previously determined as \
being relevant to +     * the current composite. It will then drive the call to \
determine if this represents a method +     * that has been overridden. If it \
represents an overriding method declaration it will remove +     * the inherited \
methods from the list leaving only the most basic method declaration. +     *
+     * @param methodList - <code>ArrayList</code> list of relevant methods
+     * @param dbc        - <code>DescriptionBuilderComposite</code> current \
composite +     * @return - <code>ArrayList</code>
+     */
+    protected ArrayList<MethodDescriptionComposite> removeOverriddenMethods(
+        ArrayList<MethodDescriptionComposite> methodList, \
DescriptionBuilderComposite dbc, EndpointInterfaceDescriptionImpl eid) { +        \
Map<String, Integer> hierarchyMap = dbc.isInterface() ? getInterfaceHierarchy(dbc, \
eid) +            : getClassHierarchy(dbc, eid);
+        ArrayList<MethodDescriptionComposite> returnMethods = new \
ArrayList<MethodDescriptionComposite>(); +        for (int i = 0; i < \
methodList.size(); i++) { +            if (notFound(returnMethods, \
methodList.get(i))) { +                \
returnMethods.add(getBaseMethod(methodList.get(i), i, methodList, hierarchyMap)); +   \
} +
+        }
+        return returnMethods;
+    }
+
+    /**
+     * This method drives the establishment of the hierarchy of interfaces for an \
SEI. +     */
+    private Map<String, Integer> getInterfaceHierarchy(DescriptionBuilderComposite \
dbc, EndpointInterfaceDescriptionImpl eid) { +        if (log.isDebugEnabled()) {
+            log.debug("Getting interface hierarchy for: " + dbc.getClassName());
+        }
+        Map<String, Integer> hierarchyMap = new HashMap<String, Integer>();
+        hierarchyMap.put(dbc.getClassName(), 0);
+        return getInterfaceHierarchy(dbc.getInterfacesList(), hierarchyMap, 1, eid);
+    }
+
+    protected ArrayList<MethodDescriptionComposite> \
retrieveSEIMethods(DescriptionBuilderComposite dbc) { +
+        //Rules for retrieving Methods on an SEI (or a superclass of an SEI) are \
simple +        //Just retrieve all methods regardless of WebMethod annotations
+        ArrayList<MethodDescriptionComposite> retrieveList = new \
ArrayList<MethodDescriptionComposite>(); +
+        Iterator<MethodDescriptionComposite> iter = null;
+        List<MethodDescriptionComposite> mdcList = dbc.getMethodDescriptionsList();
+
+        if (mdcList != null) {
+            iter = dbc.getMethodDescriptionsList().iterator();
+            while (iter.hasNext()) {
+                MethodDescriptionComposite mdc = iter.next();
+                mdc.setDeclaringClass(dbc.getClassName());
+                retrieveList.add(mdc);
+            }
+        }
+
+        return retrieveList;
+    }
+
+    /**
+     * This method will establish a <code>HashMap</code> that represents a class \
name of a composite +     * and an integer value for the entry. The integer \
represents the classes level in the Java +     * hierarchy. 0 represents the most \
basic class with n representing the highest level class. +     *
+     * @param dbc - <code>DescriptionBuilderComposite</code>
+     * @return - <code>HashMap</code>
+     */
+    private HashMap<String, Integer> getClassHierarchy(DescriptionBuilderComposite \
dbc, EndpointInterfaceDescriptionImpl eid) { +        HashMap<String, \
DescriptionBuilderComposite> dbcMap = eid.getEndpointDescriptionImpl() +        \
.getServiceDescriptionImpl().getDBCMap(); +        HashMap<String, Integer> \
hierarchyMap = new HashMap<String, Integer>(); +        if (log.isDebugEnabled()) {
+            log.debug("Putting class at base level: " + dbc.getClassName());
+        }
+        hierarchyMap.put(dbc.getClassName(), Integer.valueOf(0));
+        DescriptionBuilderComposite superDBC = \
dbcMap.get((dbc.getSuperClassName())); +        int i = 1;
+        while (superDBC != null && \
!superDBC.getClassName().equals("java.lang.Object")) { +            \
hierarchyMap.put(superDBC.getClassName(), Integer.valueOf(i)); +            if \
(log.isDebugEnabled()) { +                log.debug("Putting class: " + \
superDBC.getClassName() + " at hierarchy rank: " + i); +            }
+            i++;
+            superDBC = dbcMap.get(superDBC.getSuperClassName());
+        }
+        return hierarchyMap;
+    }
+
+    /**
+     * This method will loop through each method we have already identified as a \
base method and +     * compare the current method.
+     *
+     * @param mdcList - <code>ArrayList</code> identified base methods
+     * @param mdc     - <code>MethodDescriptionComposite</code> current method
+     * @return - boolean
+     */
+    private boolean notFound(ArrayList<MethodDescriptionComposite> mdcList,
+        MethodDescriptionComposite mdc) {
+        for (MethodDescriptionComposite method : mdcList) {
+            if (mdc.compare(method)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Recursive method that builds the hierarchy of interfaces. This begins with an
+     * SEI and walks all of its super interfaces.
+     */
+    private Map<String, Integer> getInterfaceHierarchy(List<String> interfaces,
+        Map<String, Integer> hierarchyMap, int level, \
EndpointInterfaceDescriptionImpl eid) { +        HashMap<String, \
DescriptionBuilderComposite> dbcMap = eid.getEndpointDescriptionImpl() +        \
.getServiceDescriptionImpl().getDBCMap(); +
+        // walk through all of the interfaces
+        if (interfaces != null && !interfaces.isEmpty()) {
+            for (String interfaze : interfaces) {
+                DescriptionBuilderComposite interDBC = dbcMap.get(interfaze);
+                if (interDBC != null) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Inserting super interface " + \
interDBC.getClassName() +                            + " at level " + level);
+                    }
+                    hierarchyMap.put(interDBC.getClassName(), level);
+                    return getInterfaceHierarchy(interDBC.getInterfacesList(), \
hierarchyMap, +                        level++, eid);
+                }
+            }
+        }
+        return hierarchyMap;
+    }
+
+    /**
+     * This method is responsible for determining the most basic level of a method \
declaration in +     * the <code>DescriptionBuilderComposite</code> hierarchy.
+     *
+     * @param mdc          - <code>MethodDescriptionComposite</code> current method
+     * @param index        - <code>int</code> current location in method list
+     * @param methodList   - <code>List</code> list of methods available on this \
composite +     * @param hierarchyMap - <code>HashMap</code> map that represents the \
hierarchy of the current +     *                     \
<code>DescriptionBuilderComposite</code> +     * @return - \
<code>MethodDescriptionComposite</code> most basic method declaration +     */
+    private static MethodDescriptionComposite \
getBaseMethod(MethodDescriptionComposite mdc, +        int index, \
ArrayList<MethodDescriptionComposite> methodList, +        Map<String, Integer> \
hierarchyMap) { +        int baseLevel = hierarchyMap.get(mdc.getDeclaringClass());
+        if (log.isDebugEnabled()) {
+            log.debug("Base method: " + mdc.getMethodName() + " initial level: " + \
baseLevel); +        }
+        for (; index < methodList.size(); index++) {
+            MethodDescriptionComposite compareMDC = methodList.get(index);
+            // If the two methods are the same method that means we have found an \
inherited +            // overridden case
+            if (mdc.equals(compareMDC)) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Found equivalent methods: " + mdc.getMethodName());
+                }
+                // get the declaration level of the method we are comparing to
+                int compareLevel = hierarchyMap.get(compareMDC.getDeclaringClass());
+                // if the method was declared by a class in a lower level of the \
hierarchy it +                // becomes the method that we will compare other \
methods to +                if (compareLevel < baseLevel) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Found method lower in hierarchy chain: "
+                            + compareMDC.getMethodName() + " of class: "
+                            + compareMDC.getMethodName());
+                    }
+                    mdc = compareMDC;
+                    baseLevel = compareLevel;
+                }
+            }
+        }
+        return mdc;
+    }
+
+}
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/or \
g/apache/axis2/jaxws/description/builder/MDQConstants.java?rev=819156&r1=819155&r2=819156&view=diff
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java \
                (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java \
Sat Sep 26 15:42:55 2009 @@ -68,4 +68,10 @@
     public static final String SOAP11JMS_MTOM_BINDING = \
                "http://http://www.example.org/2006/06/soap/bindings/JMS/?mtom=true";
     public static final String SOAP12JMS_MTOM_BINDING = \
"http://http://www.example.org/2006/06/soap/bindings/JMS/?mtom=true";  public static \
final String SOAP_HTTP_BINDING ="SOAP_HTTP_BINDING"; +    
+    public static final String USE_LEGACY_WEB_METHOD_RULES_SUN = \
"com.sun.xml.ws.model.RuntimeModeler.legacyWebMethod"; +    public static final \
String USE_LEGACY_WEB_METHOD_RULES = "jaxws.runtime.legacyWebMethod"; +    public \
static final String USE_MANIFEST_LEGACY_WEB_METHOD_RULES = "LegacyWebMethod"; +    \
public static final String SUN_WEB_METHOD_BEHAVIOR_CHANGE_VERSION = "2.1.6"; +
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/or \
g/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?rev=819156&r1=819155&r2=819156&view=diff
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java \
                (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java \
Sat Sep 26 15:42:55 2009 @@ -98,7 +98,7 @@
  * fixed, that will probably have an impact on this class.  In particular, I think \
                this should be created 
  * somehow from an AxisService/AxisPort combination, and not directly from the WSDL.
  */
-class EndpointDescriptionImpl
+public class EndpointDescriptionImpl
         implements EndpointDescription, EndpointDescriptionJava, \
EndpointDescriptionWSDL {  
     private ServiceDescriptionImpl parentServiceDescription;
@@ -723,7 +723,7 @@
         return parentServiceDescription;
     }
 
-    ServiceDescriptionImpl getServiceDescriptionImpl() {
+    public ServiceDescriptionImpl getServiceDescriptionImpl() {
         return (ServiceDescriptionImpl)parentServiceDescription;
     }
 

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/or \
g/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?rev=819156&r1=819155&r2=819156&view=diff
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java \
                (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java \
Sat Sep 26 15:42:55 2009 @@ -20,6 +20,26 @@
 
 package org.apache.axis2.jaxws.description.impl;
 
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisOperationFactory;
@@ -30,34 +50,20 @@
 import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
 import org.apache.axis2.jaxws.description.EndpointInterfaceDescriptionJava;
 import org.apache.axis2.jaxws.description.EndpointInterfaceDescriptionWSDL;
+import org.apache.axis2.jaxws.description.MethodRetriever;
 import org.apache.axis2.jaxws.description.OperationDescription;
 import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
 import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
 import org.apache.axis2.jaxws.description.builder.MDQConstants;
 import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
 import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.util.WSToolingUtils;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding;
-import javax.wsdl.Definition;
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 /** @see ../EndpointInterfaceDescription */
-class EndpointInterfaceDescriptionImpl
+public class EndpointInterfaceDescriptionImpl
         implements EndpointInterfaceDescription, EndpointInterfaceDescriptionJava,
         EndpointInterfaceDescriptionWSDL {
     private EndpointDescriptionImpl parentEndpointDescription;
@@ -95,6 +101,10 @@
     public static final javax.jws.soap.SOAPBinding.ParameterStyle \
SOAPBinding_ParameterStyle_DEFAULT =  \
javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED;  
+    private static String newRulesFlag = null;
+    
+    private static String newSunRulesFlag = null;
+    
     /**
      * Add the operationDescription to the list of operations.  Note that we can not \
                create the
      * list of dispatchable operations at this points.
@@ -211,11 +221,16 @@
         //For every MethodDescriptionComposite in this list, call \
OperationDescription   //constructor for it, then add this operation
 
-        //Retrieve the relevent method composites for this dbc (and those in the \
                superclass chain)
-        Iterator<MethodDescriptionComposite> iter = retrieveReleventMethods(dbc);
+        //Retrieve the relevant method composites for this dbc (and those in the \
superclass chain) +        
+        MethodRetriever methodRetriever = getMethodRetriever();
 
-        if (log.isDebugEnabled())
+        Iterator<MethodDescriptionComposite> iter = \
methodRetriever.retrieveMethods(); +        
+        if (log.isDebugEnabled()) {
             log.debug("EndpointInterfaceDescriptionImpl: Finished retrieving \
methods"); +        }
+        
         MethodDescriptionComposite mdc = null;
 
         while (iter.hasNext()) {
@@ -433,7 +448,7 @@
         return operationDescriptions.toArray(new OperationDescription[0]);
     }
 
-    EndpointDescriptionImpl getEndpointDescriptionImpl() {
+    public EndpointDescriptionImpl getEndpointDescriptionImpl() {
         return (EndpointDescriptionImpl)parentEndpointDescription;
     }
 
@@ -627,337 +642,6 @@
         return soapParameterStyle;
     }
 
-    /*
-    * Returns a non-null (possibly empty) list of MethodDescriptionComposites
-    */
-    Iterator<MethodDescriptionComposite> \
                retrieveReleventMethods(DescriptionBuilderComposite dbc) {
-
-        /*
-        * Depending on whether this is an implicit SEI or an actual SEI, Gather up \
                and build a
-        * list of MDC's. If this is an actual SEI, then starting with this DBC, \
                build a list of all
-        * MDC's that are public methods in the chain of extended classes.
-        * If this is an implicit SEI, then starting with this DBC,
-        *  1. If a false exclude is found, then take only those that have false \
                excludes
-        *  2. Assuming no false excludes, take all public methods that don't have \
                exclude == true
-        *  3. For each super class, if 'WebService' present, take all MDC's \
                according to rules 1&2
-        *    But, if WebService not present, grab only MDC's that are annotated.
-        */
-        if (log.isTraceEnabled()) {
-            log.trace("retrieveReleventMethods: Enter");
-        }
-
-        ArrayList<MethodDescriptionComposite> retrieveList =
-                new ArrayList<MethodDescriptionComposite>();
-
-        if (dbc.isInterface()) {
-            if(log.isDebugEnabled()) {
-                log.debug("Removing overridden methods for interface: " + \
                dbc.getClassName() + 
-                          " with super interface: " + dbc.getSuperClassName());
-            }
-            
-            // make sure we retrieve all the methods, then remove the overridden
-            // methods that exist in the base interface
-            retrieveList = retrieveSEIMethodsChain(dbc);
-            retrieveList = removeOverriddenMethods(retrieveList, dbc);
-            
-        } else {
-            //this is an implied SEI...rules are more complicated
-
-            retrieveList = retrieveImplicitSEIMethods(dbc);
-
-            //Now, continue to build this list with relevent methods in the chain of
-            //superclasses. If the logic for processing superclasses is the same as \
                for
-            //the original SEI, then we can combine this code with above code. But, \
                its possible
-            //the logic is different for superclasses...keeping separate for now.
-            DescriptionBuilderComposite tempDBC = dbc;
-
-            while (!DescriptionUtils.isEmpty(tempDBC.getSuperClassName())) {
-
-                //verify that this superclass name is not
-                //      java.lang.object, if so, then we're done processing
-                if (DescriptionUtils.javifyClassName(tempDBC.getSuperClassName())
-                        .equals(MDQConstants.OBJECT_CLASS_NAME))
-                    break;
-
-                DescriptionBuilderComposite superDBC =
-                        \
                getEndpointDescriptionImpl().getServiceDescriptionImpl().getDBCMap()
-                                .get(tempDBC.getSuperClassName());
-
-                if (log.isTraceEnabled())
-                    log.trace("superclass name for this DBC is:" + \
                tempDBC.getSuperClassName());
-
-                //Verify that we can find the SEI in the composite list
-                if (superDBC == null) {
-                    throw \
                ExceptionFactory.makeWebServiceException(Messages.getMessage("seiNotFoundErr"));
                
-                }
-
-                //If the superclass contains a WebService annotation then retrieve \
                its methods
-                //as we would for the impl class, otherwise ignore the methods of \
                this
-                //superclass
-                if (superDBC.getWebServiceAnnot() != null) {
-                    //Now, gather the list of Methods just like we do for the lowest \
                subclass
-                    retrieveList.addAll(retrieveImplicitSEIMethods(superDBC));
-                }
-                tempDBC = superDBC;
-            } //Done with implied SEI's superclasses
-            retrieveList = removeOverriddenMethods(retrieveList, dbc);
-        }//Done with implied SEI's
-
-        return retrieveList.iterator();
-    }
-
-
-    /**
-     * This method will establish a <code>HashMap</code> that represents a class \
                name of a composite
-     * and an integer value for the entry. The integer represents the classes level \
                in the Java
-     * hierarchy. 0 represents the most basic class with n representing the highest \
                level class.
-     *
-     * @param dbc - <code>DescriptionBuilderComposite</code>
-     * @return - <code>HashMap</code>
-     */
-    private HashMap<String, Integer> getClassHierarchy(DescriptionBuilderComposite \
                dbc) {
-        HashMap<String, DescriptionBuilderComposite> dbcMap = \
                getEndpointDescriptionImpl().
-                getServiceDescriptionImpl().getDBCMap();
-        HashMap<String, Integer> hierarchyMap = new HashMap<String, Integer>();
-        if (log.isDebugEnabled()) {
-            log.debug("Putting class at base level: " + dbc.getClassName());
-        }
-        hierarchyMap.put(dbc.getClassName(), Integer.valueOf(0));
-        DescriptionBuilderComposite superDBC = \
                dbcMap.get((dbc.getSuperClassName()));
-        int i = 1;
-        while (superDBC != null && \
                !superDBC.getClassName().equals("java.lang.Object")) {
-            hierarchyMap.put(superDBC.getClassName(), Integer.valueOf(i));
-            if (log.isDebugEnabled()) {
-                log.debug("Putting class: " + superDBC.getClassName() + " at \
                hierarchy rank: " +
-                        i);
-            }
-            i++;
-            superDBC = dbcMap.get(superDBC.getSuperClassName());
-        }
-        return hierarchyMap;
-    }
-    
-    /**
-     * This method drives the establishment of the hierarchy of interfaces for an \
                SEI.
-     */
-    private Map<String, Integer> getInterfaceHierarchy(DescriptionBuilderComposite \
                dbc) {
-        if(log.isDebugEnabled()) {
-            log.debug("Getting interface hierarchy for: " + dbc.getClassName());
-        }
-        Map<String, Integer> hierarchyMap = new HashMap<String, Integer>();
-        hierarchyMap.put(dbc.getClassName(), 0);
-        return getInterfaceHierarchy(dbc.getInterfacesList(), 
-                                     hierarchyMap, 
-                                     1);
-    }
-
-    /**
-     * Recursive method that builds the hierarchy of interfaces. This begins with an
-     * SEI and walks all of its super interfaces.
-     */
-    private Map<String, Integer> getInterfaceHierarchy(List<String> interfaces,
-                                                           Map<String, Integer> \
                hierarchyMap,
-                                                           int level) {
-        HashMap<String, DescriptionBuilderComposite> dbcMap = \
                getEndpointDescriptionImpl().
-            getServiceDescriptionImpl().getDBCMap();
-        
-        // walk through all of the interfaces
-        if(interfaces != null
-                &&
-                !interfaces.isEmpty()) {
-            for(String interfaze : interfaces) {
-                DescriptionBuilderComposite interDBC = dbcMap.get(interfaze);
-                if(interDBC != null) {
-                    if(log.isDebugEnabled()) {
-                        log.debug("Inserting super interface " + \
                interDBC.getClassName() + 
-                                  " at level " + level);
-                    }
-                    hierarchyMap.put(interDBC.getClassName(), level);
-                    return getInterfaceHierarchy(interDBC.getInterfacesList(), \
                hierarchyMap, level++);
-                }
-            }
-        }
-        return hierarchyMap;
-    }
-
-    /**
-     * This method will loop through each method that was previously determined as \
                being relevant to
-     * the current composite. It will then drive the call to determine if this \
                represents a method
-     * that has been overridden. If it represents an overriding method declaration \
                it will remove
-     * the inherited methods from the list leaving only the most basic method \
                declaration.
-     *
-     * @param methodList - <code>ArrayList</code> list of relevant methods
-     * @param dbc        - <code>DescriptionBuilderComposite</code> current \
                composite
-     * @return - <code>ArrayList</code>
-     */
-    private ArrayList<MethodDescriptionComposite> removeOverriddenMethods(
-            ArrayList<MethodDescriptionComposite>
-                    methodList, DescriptionBuilderComposite dbc) {
-        Map<String, Integer> hierarchyMap = dbc.isInterface() ? \
                getInterfaceHierarchy(dbc) : 
-            getClassHierarchy(dbc);
-        ArrayList<MethodDescriptionComposite> returnMethods =
-                new ArrayList<MethodDescriptionComposite>();
-        for (int i = 0; i < methodList.size(); i++) {
-            if (notFound(returnMethods, methodList.get(i))) {
-                returnMethods.add(getBaseMethod(methodList.get(i), i, methodList, \
                hierarchyMap));
-            }
-
-        }
-        return returnMethods;
-    }
-
-    /**
-     * This method will loop through each method we have already identified as a \
                base method and
-     * compare the current method.
-     *
-     * @param mdcList - <code>ArrayList</code> identified base methods
-     * @param mdc     - <code>MethodDescriptionComposite</code> current method
-     * @return - boolean
-     */
-    private boolean notFound(ArrayList<MethodDescriptionComposite> mdcList,
-                             MethodDescriptionComposite mdc) {
-        for (MethodDescriptionComposite method : mdcList) {
-            if (mdc.compare(method)) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * This method is responsible for determining the most basic level of a method \
                declaration in
-     * the <code>DescriptionBuilderComposite</code> hierarchy.
-     *
-     * @param mdc          - <code>MethodDescriptionComposite</code> current method
-     * @param index        - <code>int</code> current location in method list
-     * @param methodList   - <code>List</code> list of methods available on this \
                composite
-     * @param hierarchyMap - <code>HashMap</code> map that represents the hierarchy \
                of the current
-     *                     <code>DescriptionBuilderComposite</code>
-     * @return - <code>MethodDescriptionComposite</code> most basic method \
                declaration
-     */
-    private static MethodDescriptionComposite \
                getBaseMethod(MethodDescriptionComposite mdc,
-                                                            int index,
-                                                            \
                ArrayList<MethodDescriptionComposite> methodList,
-                                                            Map<String, Integer>
-                                                                    hierarchyMap) {
-        int baseLevel = hierarchyMap.get(mdc.getDeclaringClass());
-        if (log.isDebugEnabled()) {
-            log.debug("Base method: " + mdc.getMethodName() + " initial level: " + \
                baseLevel);
-        }
-        for (; index < methodList.size(); index++) {
-            MethodDescriptionComposite compareMDC = methodList.get(index);
-            // If the two methods are the same method that means we have found an \
                inherited
-            // overridden case
-            if (mdc.equals(compareMDC)) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Found equivalent methods: " + mdc.getMethodName());
-                }
-                // get the declaration level of the method we are comparing to
-                int compareLevel = hierarchyMap.get(compareMDC.getDeclaringClass());
-                // if the method was declared by a class in a lower level of the \
                hierarchy it
-                // becomes the method that we will compare other methods to
-                if (compareLevel < baseLevel) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("Found method lower in hierarchy chain: " +
-                                compareMDC.getMethodName()
-                                + " of class: " + compareMDC.getMethodName());
-                    }
-                    mdc = compareMDC;
-                    baseLevel = compareLevel;
-                }
-            }
-        }
-        return mdc;
-    }
-
-    /*
-    * This is called when we know that this DBC is an implicit SEI
-    */
-    private ArrayList<MethodDescriptionComposite> retrieveImplicitSEIMethods(
-            DescriptionBuilderComposite dbc) {
-
-        ArrayList<MethodDescriptionComposite> retrieveList =
-                new ArrayList<MethodDescriptionComposite>();
-
-        retrieveList = DescriptionUtils.getMethodsWithFalseExclusions(dbc);
-
-        //If this list is empty, then there are no false exclusions, so gather
-        //all composites that don't have exclude == true
-        //If the list is not empty, then it means we found at least one method with \
                'exclude==false'
-        //so the list should contain only those methods
-        if (retrieveList == null || retrieveList.size() == 0) {
-            Iterator<MethodDescriptionComposite> iter = null;
-            List<MethodDescriptionComposite> mdcList = \
                dbc.getMethodDescriptionsList();
-
-            if (mdcList != null) {
-                iter = dbc.getMethodDescriptionsList().iterator();
-                while (iter.hasNext()) {
-                    MethodDescriptionComposite mdc = iter.next();
-
-                    if (!DescriptionUtils.isExcludeTrue(mdc)) {
-                        mdc.setDeclaringClass(dbc.getClassName());
-                        retrieveList.add(mdc);
-                    }
-                }
-            }
-        }
-
-        return retrieveList;
-    }
-
-    private ArrayList<MethodDescriptionComposite> retrieveSEIMethods(
-            DescriptionBuilderComposite dbc) {
-
-        //Rules for retrieving Methods on an SEI (or a superclass of an SEI) are \
                simple
-        //Just retrieve all methods regardless of WebMethod annotations
-        ArrayList<MethodDescriptionComposite> retrieveList =
-                new ArrayList<MethodDescriptionComposite>();
-
-        Iterator<MethodDescriptionComposite> iter = null;
-        List<MethodDescriptionComposite> mdcList = dbc.getMethodDescriptionsList();
-
-        if (mdcList != null) {
-            iter = dbc.getMethodDescriptionsList().iterator();
-            while (iter.hasNext()) {
-                MethodDescriptionComposite mdc = iter.next();
-                mdc.setDeclaringClass(dbc.getClassName());
-                retrieveList.add(mdc);
-            }
-        }
-
-        return retrieveList;
-    }
-
-    private ArrayList<MethodDescriptionComposite> retrieveSEIMethodsChain(
-            DescriptionBuilderComposite tmpDBC) {
-
-        DescriptionBuilderComposite dbc = tmpDBC;
-        ArrayList<MethodDescriptionComposite> retrieveList =
-                new ArrayList<MethodDescriptionComposite>();
-
-        retrieveList = retrieveSEIMethods(dbc);
-
-        //Since this is an interface, anything that is in the extends clause will \
                actually appear
-        // in the interfaces list instead.
-        Iterator<String> iter = null;
-        List<String> interfacesList = dbc.getInterfacesList();
-        if (interfacesList != null) {
-            iter = dbc.getInterfacesList().iterator();
-
-            while (iter.hasNext()) {
-
-                String interfaceName = iter.next();
-                DescriptionBuilderComposite superInterface =
-                        \
                getEndpointDescriptionImpl().getServiceDescriptionImpl().getDBCMap()
-                                .get(interfaceName);
-
-                retrieveList.addAll(retrieveSEIMethodsChain(superInterface));
-            }
-        }
-
-        return retrieveList;
-    }
-
     private Definition getWSDLDefinition() {
         return ((ServiceDescriptionWSDL)getEndpointDescription().getServiceDescription())
                
                 .getWSDLDefinition();
@@ -1086,4 +770,149 @@
             }
         });
     }
+    
+    
+    /*
+     * This method returns a method retriever that properly implements the specified \
behavior,  +     * which is determined by a user-defined system property
+     */
+    private MethodRetriever getMethodRetriever () {
+
+        MethodRetriever methodRetriever = null;
+        boolean newSunBehavior = false;
+
+        //If the user has a setting for the property flag then that overrides and \
possible setting +        //of the SUN flag. Assuming no
+        //property, we will still honor the setting of the SUN property.
+        
+        //REVIEW: We are making the assumption that the system property always \
overrides the manifest +        //        property. So, if both are set than the \
manifest property will be ignored +        if \
(WSToolingUtils.hasValue(getNewRulesFlag())) { +            if \
(newRulesFlag.equalsIgnoreCase("false")) { +                if \
(log.isDebugEnabled()){ +                    \
log.debug("EndpointInterfaceDescriptionImpl: System property \
USE_LEGACY_WEB_METHOD_RULES set to false" ); +                }
+                newSunBehavior = \
isNewSunBehavior(MDQConstants.USE_LEGACY_WEB_METHOD_RULES); +            }
+        } else if (WSToolingUtils.hasValue(getNewSunRulesFlag())) {
+            if (getNewSunRulesFlag().equalsIgnoreCase("false")) {
+                if (log.isDebugEnabled()){
+                    log.debug("EndpointInterfaceDescriptionImpl: System property \
USE_LEGACY_WEB_METHOD_RULES_SUN set to false" ); +                }
+                newSunBehavior = \
isNewSunBehavior(MDQConstants.USE_LEGACY_WEB_METHOD_RULES_SUN); +            }
+        }
+        
+        methodRetriever = newSunBehavior ? new PostRI216MethodRetrieverImpl(dbc, \
this) : new LegacyMethodRetrieverImpl(dbc, this); +        
+        if(log.isDebugEnabled()) {
+            if (newSunBehavior) {
+                log.debug("getMethodRetriever: returning a \
PostRI216MethodRetrieverImpl"); +            } else {
+                log.debug("getMethodRetriever: returning a \
LegacyMethodRetrieverImpl"); +            }
+        }
+        
+        return methodRetriever;
+    }
+    
+    /**
+     * The user has indicated that they want to use the new Sun behavior \
(regardless) of which flag  +     * they were using.
+     * This method determines whether we have the proper JDK version for using the \
new SUN behavior for +     * retrieving methods. We determine this by checking the \
version of WsGen. +     * @param propertyToSet
+     * @return
+     */
+    private boolean isNewSunBehavior(String propertyToSet) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("isNewSunBehavior: Validating that JDK version can be used \
with property: " +propertyToSet); +
+        }
+        
+        boolean versionValid = false;
+
+        try {
+            
+            String wsGenVersion = WSToolingUtils.getWsGenVersion();
+            
+            versionValid = WSToolingUtils.isValidVersion(wsGenVersion);
+            
+            if (log.isDebugEnabled()) {
+                log.debug("isNewSunBehavior: versionValid is: " +versionValid);
+            }
+            
+            if (!versionValid) {
+
+                if (log.isWarnEnabled()) {
+                    log.warn("You are attempting set a property: "
+                        + propertyToSet
+                        + " This property is not supported with this version of the \
JDK"); +                }
+            }
+
+            // We don't want to affect existing systems, if anything goes
+            // wrong just display
+            // a warning and default to old behavior
+        } catch (ClassNotFoundException e) {
+            if (log.isWarnEnabled()) {
+                log.warn(" Unable to determine WsGen version being used");
+            }
+        } catch (IOException ioex) {
+            if (log.isWarnEnabled()) {
+                log.warn(" Unable to determine WsGen version being used");
+            }
+        }
+        
+        return versionValid;
+    }
+    
+    private static String getNewRulesFlag () {
+        
+        if (newRulesFlag != null) {
+            return newRulesFlag;
+        }
+            
+        try {
+            newRulesFlag = (String) AccessController.doPrivileged(
+                new PrivilegedExceptionAction() {
+                    public Object run() {
+                        return \
(System.getProperty(MDQConstants.USE_LEGACY_WEB_METHOD_RULES)); +                    \
} +                });
+        } catch (PrivilegedActionException e) {
+            // Swallow and continue
+            if (log.isWarnEnabled()) {
+                log.debug("Exception getting USE_LEGACY_WEB_METHOD_RULES system \
property: " +e.getException()); +            }
+        }
+        
+        return newRulesFlag;
+    }
+    
+    private static String getNewSunRulesFlag () {
+        
+        if (newSunRulesFlag != null) {
+            return newSunRulesFlag;
+        }
+            
+        try {
+            newSunRulesFlag = (String) AccessController.doPrivileged(
+                new PrivilegedExceptionAction() {
+                    public Object run() {
+                        return \
(System.getProperty(MDQConstants.USE_LEGACY_WEB_METHOD_RULES_SUN)); +                 \
} +                });
+        } catch (PrivilegedActionException e) {
+            // Swallow and continue
+            if (log.isWarnEnabled()) {
+                log.debug("Exception getting USE_LEGACY_WEB_METHOD_RULES_SUN system \
property: " +e.getException()); +            }
+        }
+        
+        return newRulesFlag;
+    }
+    
+
 }

Added: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/LegacyMethodRetrieverImpl.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/or \
g/apache/axis2/jaxws/description/impl/LegacyMethodRetrieverImpl.java?rev=819156&view=auto
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/LegacyMethodRetrieverImpl.java \
                (added)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/LegacyMethodRetrieverImpl.java \
Sat Sep 26 15:42:55 2009 @@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.description.impl;
+
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.description.MethodRetriever;
+import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
+import org.apache.axis2.jaxws.description.builder.MDQConstants;
+import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
+import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * LegacyMethodRetrieverImpl subclass implements the original SUN RI interpretation \
for + * annotation processing. See MethodRetriever superclass...
+ * 
+ *  Please refer to the following links for more info:
+ *  
+ *  
+ *     https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577 
+ *     http://forums.java.net/jive/thread.jspa?threadID=61630
+ *     http://forums.java.net/jive/thread.jspa?threadID=55078 
+ *
+ * 
+ */
+public class LegacyMethodRetrieverImpl extends MethodRetriever {
+
+    //Logging setup
+    private static final Log log = \
LogFactory.getLog(LegacyMethodRetrieverImpl.class); +
+    private EndpointInterfaceDescriptionImpl eid = null;
+
+    private DescriptionBuilderComposite dbc = null;
+ 
+    public LegacyMethodRetrieverImpl (DescriptionBuilderComposite dbc, 
+        EndpointInterfaceDescriptionImpl eid)  {
+        
+        super();
+        this.dbc = dbc;
+        this.eid = eid;
+    }
+
+    /*
+     * Returns a non-null (possibly empty) list of MethodDescriptionComposites
+     */
+
+    public Iterator<MethodDescriptionComposite> retrieveMethods() {
+
+
+        /*
+         * Depending on whether this is an implicit SEI or an actual SEI, Gather up \
and build a +         * list of MDC's. If this is an actual SEI, then starting with \
this DBC, build a list of all +         * MDC's that are public methods in the chain \
of extended classes. +         * If this is an implicit SEI, then starting with this \
DBC, +         *  1. If a false exclude is found, then take only those that have \
false excludes +         *  2. Assuming no false excludes, take all public methods \
that don't have exclude == true +         *  3. For each super class, if 'WebService' \
present, take all MDC's according to rules 1&2 +         *    But, if WebService not \
present, grab only MDC's that are annotated. +         */
+        if (log.isTraceEnabled()) {
+            log.trace("retrieveReleventMethods: Enter");
+        }
+
+        ArrayList<MethodDescriptionComposite> retrieveList =
+            new ArrayList<MethodDescriptionComposite>();
+
+        if (dbc.isInterface()) {
+            if(log.isDebugEnabled()) {
+                log.debug("Removing overridden methods for interface: " + \
dbc.getClassName() +  +                    " with super interface: " + \
dbc.getSuperClassName()); +            }
+
+            // make sure we retrieve all the methods, then remove the overridden
+            // methods that exist in the base interface
+            retrieveList = retrieveSEIMethodsChain(dbc, eid);
+            retrieveList = removeOverriddenMethods(retrieveList, dbc, eid);
+
+        } else {
+            //this is an implied SEI...rules are more complicated
+
+            retrieveList = retrieveImplicitSEIMethods(dbc);
+
+            //Now, continue to build this list with relevent methods in the chain of
+            //superclasses. If the logic for processing superclasses is the same as \
for +            //the original SEI, then we can combine this code with above code. \
But, its possible +            //the logic is different for superclasses...keeping \
separate for now. +            DescriptionBuilderComposite tempDBC = dbc;
+
+            while (!DescriptionUtils.isEmpty(tempDBC.getSuperClassName())) {
+
+                //verify that this superclass name is not
+                //      java.lang.object, if so, then we're done processing
+                if (DescriptionUtils.javifyClassName(tempDBC.getSuperClassName())
+                    .equals(MDQConstants.OBJECT_CLASS_NAME))
+                    break;
+
+                DescriptionBuilderComposite superDBC = 
+                    \
eid.getEndpointDescriptionImpl().getServiceDescriptionImpl().getDBCMap() +            \
.get(tempDBC.getSuperClassName()); +
+                if (log.isTraceEnabled())
+                    log.trace("superclass name for this DBC is:" + \
tempDBC.getSuperClassName()); +
+                //Verify that we can find the SEI in the composite list
+                if (superDBC == null) {
+                    throw \
ExceptionFactory.makeWebServiceException(Messages.getMessage("seiNotFoundErr")); +    \
} +
+                //If the superclass contains a WebService annotation then retrieve \
its methods +                //as we would for the impl class, otherwise ignore the \
methods of this +                //superclass
+                if (superDBC.getWebServiceAnnot() != null) {
+                    //Now, gather the list of Methods just like we do for the lowest \
subclass +                    \
retrieveList.addAll(retrieveImplicitSEIMethods(superDBC)); +                }
+                tempDBC = superDBC;
+            } //Done with implied SEI's superclasses
+            
+            retrieveList = removeOverriddenMethods(retrieveList, dbc, eid);
+            
+        }//Done with implied SEI's
+
+        return retrieveList.iterator();
+    }
+
+    /*
+     * This is called when we know that this DBC is an implicit SEI
+     */
+    private ArrayList<MethodDescriptionComposite> retrieveImplicitSEIMethods(
+        DescriptionBuilderComposite dbc) {
+
+        ArrayList<MethodDescriptionComposite> retrieveList =
+            new ArrayList<MethodDescriptionComposite>();
+
+        retrieveList = DescriptionUtils.getMethodsWithFalseExclusions(dbc);
+
+        //If this list is empty, then there are no false exclusions, so gather
+        //all composites that don't have exclude == true
+        //If the list is not empty, then it means we found at least one method with \
'exclude==false' +        //so the list should contain only those methods
+        if (retrieveList == null || retrieveList.size() == 0) {
+            Iterator<MethodDescriptionComposite> iter = null;
+            List<MethodDescriptionComposite> mdcList = \
dbc.getMethodDescriptionsList(); +
+            if (mdcList != null) {
+                iter = dbc.getMethodDescriptionsList().iterator();
+                while (iter.hasNext()) {
+                    MethodDescriptionComposite mdc = iter.next();
+
+                    if (!DescriptionUtils.isExcludeTrue(mdc)) {
+                        mdc.setDeclaringClass(dbc.getClassName());
+                        retrieveList.add(mdc);
+                    }
+                }
+            }
+        }
+
+        return retrieveList;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/PostRI216MethodRetrieverImpl.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/or \
g/apache/axis2/jaxws/description/impl/PostRI216MethodRetrieverImpl.java?rev=819156&view=auto
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/PostRI216MethodRetrieverImpl.java \
                (added)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/PostRI216MethodRetrieverImpl.java \
Sat Sep 26 15:42:55 2009 @@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.description.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.description.MethodRetriever;
+import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
+import org.apache.axis2.jaxws.description.builder.MDQConstants;
+import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
+import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * PostRI216MethodRetrieverImpl subclass implements the new SUN RI interpretation \
for + * annotation processing. See MethodRetriever superclass...
+ * 
+ *  Please refer to the following links for more info:
+ *  
+ *  
+ *     https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577 
+ *     http://forums.java.net/jive/thread.jspa?threadID=61630
+ *     http://forums.java.net/jive/thread.jspa?threadID=55078 
+ *
+ * 
+ */
+public class PostRI216MethodRetrieverImpl extends MethodRetriever {
+
+    //Logging setup
+    private static final Log log = \
LogFactory.getLog(PostRI216MethodRetrieverImpl.class); +
+   private EndpointInterfaceDescriptionImpl eid = null;
+
+   private DescriptionBuilderComposite dbc = null;
+
+    public PostRI216MethodRetrieverImpl (DescriptionBuilderComposite dbc, 
+        EndpointInterfaceDescriptionImpl eid)  {
+        super();
+        
+        this.dbc = dbc;
+        this.eid = eid;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.axis2.jaxws.description.MethodRetriever#retrieveMethods()
+     */
+    public Iterator<MethodDescriptionComposite> retrieveMethods() {
+
+        /*
+         * Depending on whether this is an implicit SEI or an actual SEI, Gather up \
and build a +         * list of MDC's. If this is an actual SEI, then starting with \
this DBC, build a list of all +         * MDC's that are public methods in the chain \
of extended classes. +         * If this is an implicit SEI, then starting with this \
DBC, +         *  1. If a false exclude is found, then take only those that have \
false excludes +         *  2. Assuming no false excludes, take all public methods \
that don't have exclude == true +         *  3. For each super class, if 'WebService' \
present, take all MDC's according to rules 1&2 +         *    But, if WebService not \
present, grab only MDC's that are annotated. +         */
+        if (log.isTraceEnabled()) {
+            log.trace("retrieveMethods: Enter");
+        }
+
+        ArrayList<MethodDescriptionComposite> retrieveList = new \
ArrayList<MethodDescriptionComposite>(); +
+        if (dbc.isInterface()) {
+            if (log.isDebugEnabled()) {
+                log.debug("Removing overridden methods for interface: " + \
dbc.getClassName() +                    + " with super interface: " + \
dbc.getSuperClassName()); +            }
+
+            // make sure we retrieve all the methods, then remove the overridden
+            // methods that exist in the base interface
+            retrieveList = retrieveSEIMethodsChain(dbc, eid);
+            retrieveList = removeOverriddenMethods(retrieveList, dbc, eid);
+
+        } else {
+            //this is an implied SEI...rules are more complicated
+
+            retrieveList = retrieveImplicitSEIMethods(dbc);
+
+            //Now, continue to build this list with relevent methods in the chain of
+            //superclasses. If the logic for processing superclasses is the same as \
for +            //the original SEI, then we can combine this code with above code. \
But, its possible +            //the logic is different for superclasses...keeping \
separate for now. +            DescriptionBuilderComposite tempDBC = dbc;
+
+            while (!DescriptionUtils.isEmpty(tempDBC.getSuperClassName())) {
+
+                //verify that this superclass name is not
+                //      java.lang.object, if so, then we're done processing
+                if (DescriptionUtils.javifyClassName(tempDBC.getSuperClassName()).equals(
 +                    MDQConstants.OBJECT_CLASS_NAME))
+                    break;
+
+                DescriptionBuilderComposite superDBC = \
eid.getEndpointDescriptionImpl() +                \
.getServiceDescriptionImpl().getDBCMap().get(tempDBC.getSuperClassName()); +
+                if (log.isTraceEnabled())
+                    log.trace("superclass name for this DBC is:" + \
tempDBC.getSuperClassName()); +
+                //Verify that we can find the SEI in the composite list
+                if (superDBC == null) {
+                    throw ExceptionFactory.makeWebServiceException(Messages
+                        .getMessage("seiNotFoundErr"));
+                }
+
+                // Now, gather the list of Methods just like we do for
+                // the lowest subclass
+                retrieveList.addAll(retrieveImplicitSEIMethods(superDBC));
+                tempDBC = superDBC;
+            } //Done with implied SEI's superclasses
+            retrieveList = removeOverriddenMethods(retrieveList, dbc, eid);
+        }//Done with implied SEI's
+
+        return retrieveList.iterator();
+    }
+
+    /*
+     * This is called when we know that this DBC is an implicit SEI and the user has \
set the +     * property for using Suns new behavior in JDK 1.6. We will retrieve all \
the public methods +     * that do not have @WebMethod(exclude == true). 
+     */
+    private ArrayList<MethodDescriptionComposite> retrieveImplicitSEIMethods(
+        DescriptionBuilderComposite dbc) {
+
+        ArrayList<MethodDescriptionComposite> retrieveList = new \
ArrayList<MethodDescriptionComposite>(); +
+        Iterator<MethodDescriptionComposite> iter = null;
+        List<MethodDescriptionComposite> mdcList = dbc.getMethodDescriptionsList();
+
+        if (mdcList != null) {
+            iter = dbc.getMethodDescriptionsList().iterator();
+            while (iter.hasNext()) {
+                MethodDescriptionComposite mdc = iter.next();
+
+                if (!DescriptionUtils.isExcludeTrue(mdc)) {
+                    mdc.setDeclaringClass(dbc.getClassName());
+                    retrieveList.add(mdc);
+                }
+            }
+        }
+
+        return retrieveList;
+    }
+
+
+}

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/or \
g/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?rev=819156&r1=819155&r2=819156&view=diff
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java \
                (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java \
Sat Sep 26 15:42:55 2009 @@ -92,7 +92,7 @@
 
 
 /** @see ../ServiceDescription */
-class ServiceDescriptionImpl
+public class ServiceDescriptionImpl
         implements ServiceDescription, ServiceDescriptionWSDL, \
ServiceDescriptionJava {  private ClientConfigurationFactory clientConfigFactory;
     private ConfigurationContext configContext;
@@ -1387,7 +1387,7 @@
         return isServerSide;
     }
 
-    HashMap<String, DescriptionBuilderComposite> getDBCMap() {
+    public HashMap<String, DescriptionBuilderComposite> getDBCMap() {
         return dbcMap;
     }
 

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointInterfaceDescriptionValidator.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/or \
g/apache/axis2/jaxws/description/validator/EndpointInterfaceDescriptionValidator.java?rev=819156&r1=819155&r2=819156&view=diff
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointInterfaceDescriptionValidator.java \
                (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointInterfaceDescriptionValidator.java \
Sat Sep 26 15:42:55 2009 @@ -23,6 +23,8 @@
 import org.apache.axis2.jaxws.description.EndpointInterfaceDescriptionJava;
 import org.apache.axis2.jaxws.description.EndpointInterfaceDescriptionWSDL;
 import org.apache.axis2.jaxws.description.OperationDescription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.wsdl.Operation;
 import javax.wsdl.PortType;
@@ -38,6 +40,7 @@
     EndpointInterfaceDescriptionJava epInterfaceDescJava;
     EndpointInterfaceDescriptionWSDL epInterfaceDescWSDL;
 
+    private static final Log log = \
                LogFactory.getLog(EndpointInterfaceDescriptionValidator.class);
     public EndpointInterfaceDescriptionValidator(EndpointInterfaceDescription \
toValidate) {  epInterfaceDesc = toValidate;
         epInterfaceDescJava = (EndpointInterfaceDescriptionJava)epInterfaceDesc;
@@ -72,12 +75,52 @@
                 epInterfaceDesc.getDispatchableOperations();
     
             if (wsdlOperationList.size() != dispatchableOpDescArray.length) {
-                addValidationFailure(this, "The number of operations in the WSDL " +
-                        "portType does not match the number of methods in the SEI or \
                " +
-                        "Web service implementation class.  " +
-                        "wsdl operations = [" + toString(wsdlOperationList) +"] " +
-                        "dispatch operations = [" + \
                toString(dispatchableOpDescArray) +"]");
-                return INVALID;
+                //We used to throw a Validation error here.
+                //I am removing the validation error due to new interpretations
+                // of @WebMethod annotations introduced in 2.2 TCK and newer RI/JDK \
wsgen tools, +                //where it's possilbe for a wsdl to have more \
operations than what the jaxws  +                //runtime exposes from the SEI impl.
+                
+                //For Example server endpoint defines the following operations
+                // @WebService
+                // public MySEIImpl {
+                //public boolean x() {...}
+                //@WebMethod(exclude=false)
+                //public boolean y(){ ...}
+                //public String z(){ ...} 
+                // ..}
+                
+                //A wsGen run on this will generate a wsdl with following operations
+                //<operation name="x">
+                //<operation name="y">
+                //<operation name="z">
+                
+                // And this is the WSDL Provider would return in a ?wsld request,
+                // even though the provider may only allow you to dispatch to \
operation y. +
+                // To avoid security exposure, the provider may not be
+                // able to expose operations x & z, unless it's specifically
+                // requested to do so by service application.  If client neglects to \
regen their  +                // artifacts, it's SEI will only contain operation y.
+                // This is the reason why we need to relax this error.
+                
+                // The additional 
+                // operation can be invoked using JAX-WS Dispatch client, 
+                // or by regenerating the client artifacts (wsimport)
+                // and only when the service chooses for the runtime to expose those
+                // operations via custom settings.
+
+                //If TCK tests complaint here, we might have to reverse this
+                //change and add the validaiton back.
+                                 
+                if(log.isWarnEnabled()){
+                    log.warn("The number of operations in the WSDL " +
+                            "portType does not match the number of methods in the \
SEI or " + +                            "Web service implementation class.  " +
+                            "wsdl operations = [" + toString(wsdlOperationList) +"] \
" + +                            "dispatch operations = [" + \
toString(dispatchableOpDescArray) +"]"); +                }
+                return VALID;
             }
 
             // If they are the same size, let's check to see if the operation names \
match

Added: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSToolingUtils.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSToolingUtils.java?rev=819156&view=auto
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSToolingUtils.java \
                (added)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSToolingUtils.java \
Sat Sep 26 15:42:55 2009 @@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.util;
+
+import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import java.io.IOException;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Properties;
+
+public class WSToolingUtils {
+
+    private static final Log log = LogFactory.getLog(WSToolingUtils.class);
+
+    /**
+     * A handy function to check for empty or null string
+     * 
+     * @param str
+     * @return boolean
+     * 
+     */
+    public static boolean hasValue(String str) {
+        return ((str != null) && (str.length() > 0));
+    }
+
+    /**
+     * Retrieves the major version number of the WsGen class that we're using
+     * 
+     * @return String
+     * 
+     */
+    public static String getWsGenVersion() throws ClassNotFoundException, \
IOException { +
+        Class clazz = null;
+        try {
+
+            clazz = forName("com.sun.tools.ws.WsGen", false,
+                getContextClassLoader(null));
+
+        } catch (ClassNotFoundException e1) {
+
+            try {
+
+                clazz = forName("com.sun.tools.internal.ws.WsGen", false,
+                    getContextClassLoader(null));
+
+            } catch (ClassNotFoundException e2) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Exception thrown from getWsGenVersion: " + \
e2.getMessage(), e2); +                }
+                throw (ClassNotFoundException) e2.getException();
+            }
+        }
+
+        Properties p = new Properties();
+
+        try {
+
+            p.load(clazz.getResourceAsStream("version.properties"));
+
+        } catch (IOException ioex) {
+            if (log.isDebugEnabled()) {
+                log.debug("Exception thrown from getWsGenVersion: " + \
ioex.getMessage(), ioex); +
+            }
+            throw (IOException) ioex.getCause();
+        }
+
+        return (p.getProperty("major-version"));
+    }
+
+    /**
+     * @return ClassLoader
+     */
+    private static ClassLoader getContextClassLoader(final ClassLoader classLoader) \
{ +        ClassLoader cl;
+        try {
+            cl = (ClassLoader) AccessController.doPrivileged(
+                new PrivilegedExceptionAction() {
+                    public Object run() throws ClassNotFoundException {
+                        return classLoader != null ? classLoader : \
Thread.currentThread().getContextClassLoader(); +                    }
+                }
+            );
+        } catch (PrivilegedActionException e) {
+            if (log.isDebugEnabled()) {
+                log.debug("Exception thrown from AccessController: " + \
e.getMessage(), e); +            }
+            throw ExceptionFactory.makeWebServiceException(e.getException());
+        }
+
+        return cl;
+    }
+
+    /**
+     * Return the class for this name
+     *
+     * @return Class
+     */
+    private static Class forName(final String className, final boolean initialize,
+        final ClassLoader classloader) throws ClassNotFoundException {
+        Class cl = null;
+        try {
+            cl = (Class) AccessController.doPrivileged(
+                new PrivilegedExceptionAction() {
+                    public Object run() throws ClassNotFoundException {
+                        return Class.forName(className, initialize, classloader);
+                    }
+                }
+            );
+        } catch (PrivilegedActionException e) {
+            if (log.isDebugEnabled()) {
+                log.debug("Exception thrown from AccessController: " + \
e.getMessage(), e); +            }
+            throw (ClassNotFoundException) e.getException();
+        }
+
+        return cl;
+    }
+
+    public static boolean isValidVersion(String wsGenVersion) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("isValidVersion: Determining if WsGen version: " +wsGenVersion
+                +" is appropriate version for using new SUN RI behavior");
+        }
+
+        // Beginning of reuseable code
+        final int VERSION_FIELD_1 = 2;
+        final int VERSION_FIELD_2 = 1;
+        final int VERSION_FIELD_3 = 6;
+
+        String version = wsGenVersion.trim();
+
+        //Algorithm assumption 1: We are assuming that the version string will \
always be  +        // of the form "x.x.x" where x is a character (or series of \
characters) with each digit +        // having a converted integer value of 0 - 9. 
+        //Assumption 2: We are assuming thatWsgen version 2.1.6 is the starting \
version  +        // for being able to use the new Sun behavior
+
+        int dotIndex = version.indexOf(".");        
+        int subField = Integer.valueOf(version.substring(0, dotIndex));
+
+        if (subField < VERSION_FIELD_1) {
+            return false;
+        } else if (subField > VERSION_FIELD_1) {
+            //If we are greater than 2.x.x (i.e. 3.x.x) then version is valid
+            return true;
+        }
+
+        String subString2 = version.substring(dotIndex + 1);
+        dotIndex = subString2.indexOf(".");
+        subField = Integer.valueOf(subString2.substring(0, dotIndex));
+
+        if (subField < VERSION_FIELD_2) {
+            return false;
+        } else if (subField > VERSION_FIELD_2) {
+            //If we are greater than 2.1.x (i.e. 2.2.x) then version is valid
+            return true;
+        }
+
+        //Final substring, will probably hit end of string. But, check to make sure \
there is not +        // another "." (i.e. We could have "2.1.6.1")yes.
+        String subString3 = subString2.substring(dotIndex + 1);
+
+        //Does string contain another dot? if so, just read up to that dot. \
Otherwise, assume that  +        //this is the last sub-string
+        dotIndex = subString3.indexOf(".");
+        if (dotIndex == -1) {
+            subField = Integer.valueOf(subString3);
+        } else {
+            subField = Integer.valueOf(subString3.substring(0, dotIndex));
+        }
+
+        if (subField < VERSION_FIELD_3) {
+            return false;
+        }
+
+        return true;
+    }
+}

Modified: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/o \
rg/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java?rev=819156&r1=819155&r2=819156&view=diff
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java \
                (original)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java \
Sat Sep 26 15:42:55 2009 @@ -23,7 +23,9 @@
 import junit.framework.TestCase;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.jaxws.description.builder.MDQConstants;
 import org.apache.axis2.jaxws.description.echo.EchoServiceImplWithSEI;
+import org.apache.axis2.jaxws.util.WSToolingUtils;
 import org.apache.log4j.BasicConfigurator;
 
 import javax.jws.Oneway;
@@ -36,6 +38,8 @@
 import javax.xml.ws.RequestWrapper;
 import javax.xml.ws.ResponseWrapper;
 
+import java.io.IOException;
+
 /**
  * Tests the creation of the Description classes based on a service implementation \
                bean and various
  * combinations of annotations
@@ -526,6 +530,191 @@
         assertNull(operationDescs);
 
     }
+    
+    
+    //Verify that 
+    // 1. Wsgen version 2.1.6 is valid for using the new behavior
+    // 2. Something greater than 2.1.6 is also valid
+    // 3. Something less that 2.1.6 is not valid
+    public void testValidWsgenVersion() {
+        
+        assertTrue(WSToolingUtils.isValidVersion(MDQConstants.SUN_WEB_METHOD_BEHAVIOR_CHANGE_VERSION));
 +
+        //This should be true because it converts to something greater than 2.1.6
+        assertTrue(WSToolingUtils.isValidVersion("2.12.6.1"));
+        
+        //Less than 2.1.6 so should fail
+        assertFalse(WSToolingUtils.isValidVersion("2.1.1"));
+    }
+
+    //This test verifies that the old WebMethod behavior has not changed if the \
system flag is +    //not set, slightly redundant but still a safety check
+    public void testWebMethodOldBehavior1() {
+        
+        try {
+            //If the version is valid then try the new behavior
+            if (WSToolingUtils.isValidVersion(WSToolingUtils.getWsGenVersion())) {
+                System.setProperty(MDQConstants.USE_LEGACY_WEB_METHOD_RULES, \
"false"); +                //Try new behavior
+            }            
+        } catch (ClassNotFoundException e) {
+        } catch (IOException ioex) {
+        }
+        
+        
+        EndpointInterfaceDescription testEndpointInterfaceDesc =
+                getEndpointInterfaceDesc(WebMethodTestImpl.class);
+        
+
+        // Test results from method with no annotation
+        OperationDescription[] operationDescs =
+                testEndpointInterfaceDesc.getOperationForJavaMethod("method1");
+
+        assertNull(operationDescs);
+
+        OperationDescription operationDesc =
+                testEndpointInterfaceDesc.getOperationForJavaMethod("method2")[0];
+        assertNotNull(operationDesc);
+        assertEquals("renamedMethod2", operationDesc.getOperationName());
+        assertEquals("", operationDesc.getAction());
+        assertFalse(operationDesc.isExcluded());
+
+        operationDesc = \
testEndpointInterfaceDesc.getOperationForJavaMethod("method3")[0]; +        \
assertNotNull(operationDesc); +        assertEquals("method3", \
operationDesc.getOperationName()); +        assertEquals("ActionMethod3", \
operationDesc.getAction()); +        assertFalse(operationDesc.isExcluded());
+
+        operationDesc = \
testEndpointInterfaceDesc.getOperationForJavaMethod("method4")[0]; +        \
assertNotNull(operationDesc); +        assertEquals("renamedMethod4", \
operationDesc.getOperationName()); +        assertEquals("ActionMethod4", \
operationDesc.getAction()); +        assertFalse(operationDesc.isExcluded());
+
+        operationDesc = \
testEndpointInterfaceDesc.getOperationForJavaMethod("method4")[0]; +        \
assertNotNull(operationDesc); +        assertEquals("renamedMethod4", \
operationDesc.getOperationName()); +        assertEquals("ActionMethod4", \
operationDesc.getAction()); +        assertFalse(operationDesc.isExcluded());
+
+        operationDescs = \
testEndpointInterfaceDesc.getOperationForJavaMethod("method5"); +        \
assertNull(operationDescs); +
+    }
+
+    //This test verifies that, if we do have the appropriate JDK installed but we do \
not set +    //the System property then the old behavior remains unchanged
+    public void testWebMethodOldBehavior2() {
+        
+        try {
+            //If the version is valid then try the new behavior
+            if (WSToolingUtils.isValidVersion(WSToolingUtils.getWsGenVersion())) {
+                //Set the property to empty just to make sure we are not trying the \
new behavior +                //In order for the new behavior to work, this must be \
set explicitly to 'false' +                \
System.setProperty(MDQConstants.USE_LEGACY_WEB_METHOD_RULES, ""); +                \
//Try new behavior +            } else {
+                //At this point, just return as it would be redundant to \
continue...already tested +                // in testWebMethodOldBehavior1
+                return;
+            }
+        } catch (ClassNotFoundException e) {
+        } catch (IOException ioex) {
+        }
+        
+        
+        EndpointInterfaceDescription testEndpointInterfaceDesc =
+                getEndpointInterfaceDesc(WebMethodTestImpl.class);
+        
+
+        // Test results from method with no annotation
+        OperationDescription[] operationDescs =
+                testEndpointInterfaceDesc.getOperationForJavaMethod("method1");
+
+        assertNull(operationDescs);
+
+        OperationDescription operationDesc =
+                testEndpointInterfaceDesc.getOperationForJavaMethod("method2")[0];
+        assertNotNull(operationDesc);
+        assertEquals("renamedMethod2", operationDesc.getOperationName());
+        assertEquals("", operationDesc.getAction());
+        assertFalse(operationDesc.isExcluded());
+
+        operationDesc = \
testEndpointInterfaceDesc.getOperationForJavaMethod("method3")[0]; +        \
assertNotNull(operationDesc); +        assertEquals("method3", \
operationDesc.getOperationName()); +        assertEquals("ActionMethod3", \
operationDesc.getAction()); +        assertFalse(operationDesc.isExcluded());
+
+        operationDesc = \
testEndpointInterfaceDesc.getOperationForJavaMethod("method4")[0]; +        \
assertNotNull(operationDesc); +        assertEquals("renamedMethod4", \
operationDesc.getOperationName()); +        assertEquals("ActionMethod4", \
operationDesc.getAction()); +        assertFalse(operationDesc.isExcluded());
+
+        operationDesc = \
testEndpointInterfaceDesc.getOperationForJavaMethod("method4")[0]; +        \
assertNotNull(operationDesc); +        assertEquals("renamedMethod4", \
operationDesc.getOperationName()); +        assertEquals("ActionMethod4", \
operationDesc.getAction()); +        assertFalse(operationDesc.isExcluded());
+
+        operationDescs = \
testEndpointInterfaceDesc.getOperationForJavaMethod("method5"); +        \
assertNull(operationDescs); +
+    }
+    
+    //This test verifies that, if we do have the appropriate JDK installed and we do \
set the +    //system property flag, then the new behavior will be realized. 
+    //NOTE: This method can be forced to run thru the tests by temporarily changing
+    //the "newSunBehavior" flag inside of \
EndpointInterfaceDescriptionImpl.getMethodRetriever() +    //    and
+    // in this method, by forcing "validVersion" to true. Realize that by doing this \
other tests +    // will fail...So this should be considered temporary for testing \
this method +    public void testWebMethodNewBehavior1() {
+        
+        try {
+            boolean validVersion = \
WSToolingUtils.isValidVersion(WSToolingUtils.getWsGenVersion()); +            //If \
the version is valid then try the new behavior +            
+            if (validVersion) {
+                //Try new behavior
+                System.setProperty(MDQConstants.USE_LEGACY_WEB_METHOD_RULES, \
"false"); +            } else {
+                //At this point, just return since the test would be guaranteed to \
fail as we +                //testing new rules
+                return;
+            }
+        } catch (ClassNotFoundException e) {
+        } catch (IOException ioex) {
+        }
+        
+        EndpointInterfaceDescription testEndpointInterfaceDesc =
+                getEndpointInterfaceDesc(WebMethodTestImpl1.class);
+        
+        // All tests here will be using the new behavior
+
+        //We should be able to see this even though there are false exclusions
+        OperationDescription[] operationDescs =
+            testEndpointInterfaceDesc.getOperationForJavaMethod("method1");
+
+        assertNotNull(operationDescs);
+        
+        operationDescs =
+            testEndpointInterfaceDesc.getOperationForJavaMethod("shouldBeExcludedMethod");
 +
+        assertNull(operationDescs);
+        
+        operationDescs =
+            testEndpointInterfaceDesc.getOperations();
+        assertEquals(operationDescs.length, 4);
+        
+        //Need to make sure we don't mess up the other tests, so set this back to \
using the +        //legacy behavior
+        System.setProperty(MDQConstants.USE_LEGACY_WEB_METHOD_RULES, "true");
+
+    }
+
+
 
     public void testWebResult() {
         EndpointInterfaceDescription testEndpointInterfaceDesc =
@@ -1270,6 +1459,42 @@
     }
 }
 
+//=============================================================================
+//testWebMethod service implementaiton class
+//=============================================================================
+
+//This an implied SEI which will be used to test the new Sun Behavior
+@WebService
+class WebMethodTestImpl1 {
+// No web method annotation
+public String method1(String s) {
+   return s;
+}
+
+@WebMethod(operationName = "renamedMethod2")
+public String method2(String s) {
+   return s;
+}
+
+@WebMethod(action = "ActionMethod3")
+public String method3(String s) {
+   return s;
+}
+
+@WebMethod(operationName = "renamedMethod4", action = "ActionMethod4")
+public String method4(String s) {
+   return s;
+}
+
+@WebMethod(operationName = "shouldBeExcludedMethod", exclude = true)
+public String method5(String s) {
+   return s;
+}
+}
+
+
+
+
 // =============================================================================
 // testWebMethod service implementaiton class
 // =============================================================================

Modified: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/ValidateWSDLTests.java
                
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/o \
rg/apache/axis2/jaxws/description/ValidateWSDLTests.java?rev=819156&r1=819155&r2=819156&view=diff
 ==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/ValidateWSDLTests.java \
                (original)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/ValidateWSDLTests.java \
Sat Sep 26 15:42:55 2009 @@ -81,7 +81,12 @@
         try {
             List<ServiceDescription> serviceDescList =
                     DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
-            fail();
+            
+            //Removing the fail() call here as we removed the Valdiation Error from
+            //EndpointInterfaceDescriptionValidator.
+            
+            //Expected code path
+            
         }
         catch (WebServiceException e) {
             // Expected code path


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic