You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2007/02/20 00:55:04 UTC

svn commit: r509388 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/ jaxws/src/org/apache/axis2/jaxws/message/databinding/ jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/ jaxws/src/org/apac...

Author: scheu
Date: Mon Feb 19 15:55:03 2007
New Revision: 509388

URL: http://svn.apache.org/viewvc?view=rev&rev=509388
Log:
AXIS2-2209
Contributor:Rich Scheuerle
Refactor faultbean processing into the JAXWS module to avoid class loading.

Added:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/FaultBeanDesc.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/FaultBeanDescImpl.java
Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionBuilder.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/FaultDescription.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.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/FaultDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/WrapperPackageTests.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java Mon Feb 19 15:55:03 2007
@@ -36,6 +36,7 @@
 
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.description.FaultDescription;
+import org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc;
 import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
 import org.apache.axis2.jaxws.utility.ClassUtils;
 import org.apache.axis2.jaxws.utility.PropertyDescriptorPlus;
@@ -86,29 +87,6 @@
      */
     private LegacyExceptionUtil() {}
     
-    /**
-     * A compliant exception has a @WebFault annotation and a getFaultInfo method.
-     * Legacy exceptions do not.
-     * @param cls
-     * @return true if legacy exception
-     * REVIEW perhaps this detection should be in FaultDescription
-     */
-    static boolean isLegacyException(Class cls) {
-        boolean legacyException = false;
-        
-        try {
-            Method getFaultInfo = cls.getMethod("getFaultInfo", null);
-        } catch (Exception e) {
-            // Failure indicates that this is not a legacy exception
-            legacyException = true;
-        }
-        if (legacyException) {
-            if (log.isDebugEnabled()) {
-                log.debug("Detected Legacy Exception = " + cls);
-            }
-        }
-        return legacyException;
-    }
     
     /**
      * Create a FaultBean populated with the data from the Exception t
@@ -127,7 +105,8 @@
             // REVIEW The default name should be:
             //      Package = <SEI package> or <SEI package>.jaxws
             //      Name = <exception name> + Bean
-            String faultBeanName = fd.getFaultBean();
+            FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
+            String faultBeanName = faultBeanDesc.getFaultBeanClassName();
             
             // TODO Add check that faultBeanName is correct
             if (log.isDebugEnabled()) {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java Mon Feb 19 15:55:03 2007
@@ -59,6 +59,7 @@
 import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
 import org.apache.axis2.jaxws.message.util.XMLFaultUtils;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc;
 import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
 import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescriptionFactory;
 import org.apache.axis2.jaxws.utility.ClassUtils;
@@ -526,7 +527,9 @@
                 // the legacy exception rules (B).
                 Object faultBeanObject = null;
                 
-                if (LegacyExceptionUtil.isLegacyException(t.getClass())) {
+                FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
+                String faultInfo = fd.getFaultInfo();
+                if (faultInfo == null || faultInfo.length() == 0) {
                     // Legacy Exception case
                     faultBeanObject = LegacyExceptionUtil.createFaultBean(t, fd, marshalDesc);
                 } else {
@@ -540,7 +543,7 @@
                     log.debug("The faultBean type is" + faultBeanObject.getClass().getName());
                 }
                 
-                QName faultBeanQName = new QName(fd.getTargetNamespace(), fd.getName());
+                QName faultBeanQName = new QName(faultBeanDesc.getFaultBeanNamespace(), faultBeanDesc.getFaultBeanLocalName());
                 // Make sure the faultBeanObject can be marshalled as an element
                 if (!marshalDesc.getAnnotationDesc(faultBeanObject.getClass()).hasXmlRootElement()) {
                     faultBeanObject = new JAXBElement(faultBeanQName, faultBeanObject.getClass(), faultBeanObject);
@@ -705,7 +708,9 @@
         if (elementQName != null) {
             for(int i=0; i<operationDesc.getFaultDescriptions().length && faultDesc == null; i++) {
                 FaultDescription fd = operationDesc.getFaultDescriptions()[i];
-                QName tryQName = new QName(fd.getTargetNamespace(), fd.getName());
+                FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
+                QName tryQName = new QName(faultBeanDesc.getFaultBeanNamespace(), 
+                                           faultBeanDesc.getFaultBeanLocalName());
                 if (log.isErrorEnabled()) {
                     log.debug("  FaultDescription qname is (" + tryQName + ") and detail element qname is (" + elementQName + ")");
                 }
@@ -719,7 +724,8 @@
             // If not found and RPC, retry the search using just the local name
             for(int i=0; i<operationDesc.getFaultDescriptions().length && faultDesc == null; i++) {
                 FaultDescription fd = operationDesc.getFaultDescriptions()[i];
-                String tryName = fd.getName();
+                FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
+                String tryName = faultBeanDesc.getFaultBeanLocalName();
                 if (elementQName.getLocalPart().equals(tryName)) {
                     faultDesc = fd;
                 }
@@ -735,11 +741,14 @@
             if (log.isErrorEnabled()) {
                 log.debug("Ready to demarshal service exception.  The detail entry name is " + elementQName);
             }
+            FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(faultDesc);
+            boolean isLegacy = (faultDesc.getFaultInfo() == null || faultDesc.getFaultInfo().length() == 0);
+            
             // Get the JAXB object from the block
             JAXBBlockContext blockContext = new JAXBBlockContext(marshalDesc.getPackages());        
             
             // Note that faultBean may not be a bean, it could be a primitive 
-            Class faultBeanFormalClass = loadClass(faultDesc.getFaultBean());     
+            Class faultBeanFormalClass = loadClass(faultBeanDesc.getFaultBeanClassName());     
             if (isRPC) {
                 // RPC is problem ! 
                 // Since RPC is type based, JAXB needs the declared type
@@ -771,7 +780,8 @@
                     exceptionClass, 
                     faultBeanObject, 
                     faultBeanFormalClass, 
-                    marshalDesc);
+                    marshalDesc, 
+                    isLegacy);
         }
         return exception;
     }
@@ -840,7 +850,12 @@
             cl = (Class) AccessController.doPrivileged(
                     new PrivilegedExceptionAction() {
                         public Object run() throws ClassNotFoundException {
-                            return Class.forName(className, initialize, classLoader);    
+                            // Class.forName does not support primitives
+                            Class cls = ClassUtils.getPrimitiveClass(className); 
+                            if (cls == null) {
+                                cls = Class.forName(className, initialize, classLoader);   
+                            } 
+                            return cls;                        
                         }
                     }
                   );  
@@ -895,13 +910,14 @@
             Class exceptionclass, 
             Object bean, 
             Class beanFormalType, 
-            MarshalServiceRuntimeDescription marshalDesc) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException {
+            MarshalServiceRuntimeDescription marshalDesc,
+            boolean isLegacyException) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException {
         
         if (log.isDebugEnabled()) {
             log.debug("Constructing JAX-WS Exception:" + exceptionclass);
         }
         Exception exception = null;
-        if (LegacyExceptionUtil.isLegacyException(exceptionclass)) {
+        if (isLegacyException) {
             // Legacy Exception
             exception = LegacyExceptionUtil.createFaultException(exceptionclass, bean, marshalDesc);
         } else {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java Mon Feb 19 15:55:03 2007
@@ -694,7 +694,12 @@
             cl = (Class) AccessController.doPrivileged(
                     new PrivilegedExceptionAction() {
                         public Object run() throws ClassNotFoundException {
-                            return Class.forName(className, initialize, classloader);    
+                            // Class.forName does not support primitives
+                            Class cls = ClassUtils.getPrimitiveClass(className); 
+                            if (cls == null) {
+                                cls = Class.forName(className, initialize, classloader);   
+                            } 
+                            return cls;
                         }
                     }
                   );  

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/FaultBeanDesc.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/FaultBeanDesc.java?view=auto&rev=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/FaultBeanDesc.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/FaultBeanDesc.java Mon Feb 19 15:55:03 2007
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed 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.runtime.description.marshal;
+
+/**
+ * Description of FaultBean for a FaultDescription.
+ * The FaultBean is used to marshal and unmarshal the exception.  The FaultBean
+ * is determined via annotation, faultInfo and package introspection.
+ */
+public interface FaultBeanDesc {
+    
+    /**
+     * Get the class name of the fault bean for the FaultDescription.
+     * Note that the FaultBean may not be a bean.  It can be a non-bean (i.e. String or int)
+     * 
+     * Algorithm:
+     *   1) The class defined on @WebFault of the exception
+     *   2) If not present or invalid, the class defined by getFaultInfo.
+     *   3) If not present, the class is found by looking for the
+     *      a class named <exceptionName>Bean in the interface's package.
+     *   4) If not present, the class is found by looking for the
+     *      a class named <exceptionName>Bean in the interface + jaxws package
+     * @return 
+     */
+    public String getFaultBeanClassName();
+    
+    /**
+     * Get the local name of the fault bean.
+     * Algorithm:
+     *   1) The name defined on the @WebFault of the exception.
+     *   2) If not present, the name defined via the @XmlRootElement of the fault bean class.
+     *   3) If not present, the <exceptionName>Bean
+     * @return local name
+     */
+    public String getFaultBeanLocalName();
+    
+   
+    /**
+     * Get the targetNamespace of the fault bean.
+     * Algorithm:
+     *   1) The namespace defined on the @WebFault of the exception.
+     *   2) If not present, the namespace defined via the @XmlRootElement of the class name.
+     *   3) If not present, the namespace of the method's declared class + "/jaxws"
+     * @return local name
+     */
+    public String getFaultBeanNamespace();
+    
+   
+
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java Mon Feb 19 15:55:03 2007
@@ -19,6 +19,7 @@
 import java.util.Map;
 import java.util.TreeSet;
 
+import org.apache.axis2.jaxws.description.FaultDescription;
 import org.apache.axis2.jaxws.description.OperationDescription;
 import org.apache.axis2.jaxws.description.ServiceRuntimeDescription;
 import org.apache.axis2.jaxws.utility.PropertyDescriptorPlus;
@@ -64,5 +65,11 @@
      * @return specified or defaulted wrapper class name.  Always returns null if the wrapper class does not exist.
      */
     public String getResponseWrapperClassName(OperationDescription operationDesc);
-     
+  
+    /**
+     * @param faultDesc
+     * @return FaultBeanDescriptor that describes the fault bean
+     */
+    public FaultBeanDesc getFaultBeanDesc(FaultDescription faultDesc);
+
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java Mon Feb 19 15:55:03 2007
@@ -43,6 +43,7 @@
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
 import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
+import org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc;
 import org.apache.axis2.jaxws.util.WSDL4JWrapper;
 import org.apache.axis2.jaxws.util.WSDLWrapper;
 import org.apache.axis2.jaxws.utility.ClassUtils;
@@ -149,7 +150,7 @@
        FaultDescription[] faultDescs = opDesc.getFaultDescriptions();
        if (faultDescs != null) {
            for (int i=0; i <faultDescs.length; i++) {
-               getAnnotationDescs(faultDescs[i], map);
+               getAnnotationDescs(faultDescs[i], ap, map);
            }
        }
        
@@ -189,9 +190,11 @@
      * @param faultDesc FaultDescription
      * @param set Set<Package> that is updated
      */
-    private static void getAnnotationDescs(FaultDescription faultDesc, Map<String, AnnotationDesc> map) {
-      
-      Class faultBean = loadClass(faultDesc.getFaultBean());  
+    private static void getAnnotationDescs(FaultDescription faultDesc, 
+            ArtifactProcessor ap,
+            Map<String, AnnotationDesc> map) {
+      FaultBeanDesc faultBeanDesc = ap.getFaultBeanDescMap().get(faultDesc);
+      Class faultBean = loadClass(faultBeanDesc.getFaultBeanClassName());  
       if (faultBean != null) {
           getTypeAnnotationDescs(faultBean, map);
       }
@@ -289,7 +292,12 @@
            cl = (Class) AccessController.doPrivileged(
                    new PrivilegedExceptionAction() {
                        public Object run() throws ClassNotFoundException {
-                           return Class.forName(className, initialize, classloader);    
+                           // Class.forName does not support primitives
+                           Class cls = ClassUtils.getPrimitiveClass(className); 
+                           if (cls == null) {
+                               cls = Class.forName(className, initialize, classloader);   
+                           } 
+                           return cls;
                        }
                    }
                  );  

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Feb 19 15:55:03 2007
@@ -22,9 +22,14 @@
 import java.util.Map;
 
 import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.FaultDescription;
 import org.apache.axis2.jaxws.description.OperationDescription;
 import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
+import org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc;
+import org.apache.axis2.jaxws.utility.ClassUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -43,7 +48,8 @@
     private ServiceDescription serviceDesc;
     private Map<OperationDescription, String> requestWrapperMap = new HashMap<OperationDescription, String> ();
     private Map<OperationDescription, String> responseWrapperMap = new HashMap<OperationDescription, String> ();
-
+    private Map<FaultDescription, FaultBeanDesc> faultBeanDescMap = new HashMap<FaultDescription, FaultBeanDesc>();
+    
     /**
      * Artifact Processor
      * @param serviceDesc
@@ -60,6 +66,10 @@
         return responseWrapperMap;
     }
     
+    Map<FaultDescription, FaultBeanDesc> getFaultBeanDescMap() {
+        return faultBeanDescMap;
+    }
+    
     void build() {
         for (EndpointDescription ed:serviceDesc.getEndpointDescriptions()) {
             if (ed.getEndpointInterfaceDescription() != null) {
@@ -110,12 +120,95 @@
                         responseWrapperMap.put(opDesc, foundResponseWrapperName);
                     }
                     
-                    
+                    for (FaultDescription faultDesc: opDesc.getFaultDescriptions()) {
+                        FaultBeanDesc faultBeanDesc = create(faultDesc, opDesc);
+                        faultBeanDescMap.put(faultDesc, faultBeanDesc);
+                    }
                 }
             }
         }
     }
     
+    private FaultBeanDesc create(FaultDescription faultDesc, OperationDescription opDesc) {
+        /* FaultBeanClass algorithm
+         *   1) The class defined on @WebFault of the exception
+         *   2) If not present or invalid, the class defined by getFaultInfo.
+         *   3) If not present, the class is found by looking for the
+         *      a class named <exceptionName>Bean in the interface's package.
+         *   4) If not present, the class is found by looking for the
+         *      a class named <exceptionName>Bean in the interface + jaxws package
+         */
+        String faultBeanClassName = faultDesc.getFaultBean();
+        if (faultBeanClassName == null || faultBeanClassName.length() == 0) {
+            faultBeanClassName = faultDesc.getFaultInfo();
+        }
+        if (faultBeanClassName == null || faultBeanClassName.length() == 0) {
+            String declaringClassName = opDesc.getJavaDeclaringClassName();
+            String packageName = getPackageName(declaringClassName);
+            String simpleName = getSimpleClassName(faultDesc.getExceptionClassName());
+            if (packageName.length() > 0) {
+                faultBeanClassName = packageName + "." + simpleName + "Bean";
+            } else {
+                faultBeanClassName = simpleName + "Bean";
+            }
+        }
+        String foundClassName  = findArtifact(faultBeanClassName);
+        if (foundClassName == null) {
+            faultBeanClassName = missingArtifact(faultBeanClassName);
+        }
+        
+        /* Local NameAlgorithm:
+         *   1) The name defined on the @WebFault of the exception.
+         *   2) If not present, the name defined via the @XmlRootElement of the fault bean class.
+         *   3) If not present, the <exceptionName>Bean
+         */
+        String faultBeanLocalName = faultDesc.getName();
+        if (faultBeanLocalName == null || faultBeanLocalName.length() == 0) {
+            if (faultBeanClassName != null && faultBeanClassName.length() > 0) {
+                try {
+                    Class faultBean = loadClass(faultBeanClassName);
+                    AnnotationDesc aDesc = AnnotationDescImpl.create(faultBean);
+                    if (aDesc.hasXmlRootElement()) {
+                        faultBeanLocalName = aDesc.getXmlRootElementName();
+                    }
+                } catch (Throwable t) {
+                    ExceptionFactory.makeWebServiceException(t);
+                }
+            }
+        }
+        if (faultBeanLocalName == null || faultBeanLocalName.length() == 0) {
+            faultBeanLocalName = getSimpleClassName(faultDesc.getExceptionClassName()) + "Bean";
+        }
+        
+        /* Algorithm for fault bean namespace
+         *   1) The namespace defined on the @WebFault of the exception.
+         *   2) If not present, the namespace defined via the @XmlRootElement of the class name.
+         *   3) If not present, the namespace of the method's declared class + "/jaxws"
+         */
+        String faultBeanNamespace = faultDesc.getTargetNamespace();
+        if (faultBeanNamespace == null || faultBeanNamespace.length() == 0) {
+            if (faultBeanClassName != null && faultBeanClassName.length() > 0) {
+                try {
+                    Class faultBean = loadClass(faultBeanClassName);
+                    AnnotationDesc aDesc = AnnotationDescImpl.create(faultBean);
+                    if (aDesc.hasXmlRootElement()) {
+                        faultBeanNamespace = aDesc.getXmlRootElementNamespace();
+                    }
+                } catch (Throwable t) {
+                    ExceptionFactory.makeWebServiceException(t);
+                }
+            }
+        }
+        if (faultBeanNamespace == null || faultBeanNamespace.length() == 0) {
+            faultBeanNamespace = opDesc.getEndpointInterfaceDescription().getTargetNamespace();
+        }
+        
+        return new FaultBeanDescImpl(
+                faultBeanClassName,
+                faultBeanLocalName,
+                faultBeanNamespace);
+    }
+    
     /**
      * @param className
      * @return package name
@@ -236,7 +329,12 @@
             cl = (Class) AccessController.doPrivileged(
                     new PrivilegedExceptionAction() {
                         public Object run() throws ClassNotFoundException {
-                            return Class.forName(className, initialize, classloader);    
+                            // Class.forName does not support primitives
+                            Class cls = ClassUtils.getPrimitiveClass(className); 
+                            if (cls == null) {
+                                cls = Class.forName(className, initialize, classloader);   
+                            } 
+                            return cls;
                         }
                     }
                   );  

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/FaultBeanDescImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/FaultBeanDescImpl.java?view=auto&rev=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/FaultBeanDescImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/FaultBeanDescImpl.java Mon Feb 19 15:55:03 2007
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed 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.runtime.description.marshal.impl;
+
+import org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc;
+
+class FaultBeanDescImpl implements FaultBeanDesc {
+
+    String faultBeanClassName;
+    String faultBeanLocalName;
+    String faultBeanNamespace;
+    
+    FaultBeanDescImpl(String faultBeanClassName, String faultBeanLocalName, String faultBeanNamespace) {
+        this.faultBeanClassName = faultBeanClassName;
+        this.faultBeanLocalName = faultBeanLocalName;
+        this.faultBeanNamespace = faultBeanNamespace;
+    }
+
+    public String getFaultBeanClassName() {
+        return faultBeanClassName;
+    }
+
+    public String getFaultBeanLocalName() {
+        return faultBeanLocalName;
+    }
+
+    public String getFaultBeanNamespace() {
+        return faultBeanNamespace;
+    }
+    
+    public String toString() {
+        final String newline = "\n";
+        StringBuffer string = new StringBuffer();
+        string.append(newline);
+        string.append("      FaultBean Class Name :" + faultBeanClassName);
+        string.append(newline);
+        string.append("      FaultBean Namespace  :" + faultBeanNamespace);
+        string.append(newline);
+        string.append("      FaultBean Local Name :" + faultBeanLocalName);
+        string.append(newline);
+        return string.toString();
+    }
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionBuilder.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionBuilder.java Mon Feb 19 15:55:03 2007
@@ -80,6 +80,7 @@
         }
         marshalDesc.setRequestWrapperMap(artifactProcessor.getRequestWrapperMap());
         marshalDesc.setResponseWrapperMap(artifactProcessor.getResponseWrapperMap());
+        marshalDesc.setFaultBeanDescMap(artifactProcessor.getFaultBeanDescMap());
         
         // Build the annotation map
         Map<String, AnnotationDesc> map;

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java Mon Feb 19 15:55:03 2007
@@ -5,9 +5,11 @@
 import java.util.Map.Entry;
 
 import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.description.FaultDescription;
 import org.apache.axis2.jaxws.description.OperationDescription;
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
+import org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc;
 import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
 import org.apache.axis2.jaxws.utility.PropertyDescriptorPlus;
 import org.apache.axis2.jaxws.utility.XMLRootElementUtil;
@@ -23,6 +25,7 @@
     private Map<Class, Map<String, PropertyDescriptorPlus>> pdMapCache = null;
     private Map<OperationDescription, String> requestWrapperMap = null;
     private Map<OperationDescription, String> responseWrapperMap = null;
+    private Map<FaultDescription, FaultBeanDesc> faultBeanDescMap = null;
     
     protected MarshalServiceRuntimeDescriptionImpl(String key,
                 ServiceDescription serviceDesc) {
@@ -104,14 +107,24 @@
         responseWrapperMap = map;
     }
     
+    public FaultBeanDesc getFaultBeanDesc(FaultDescription faultDesc) {
+        return faultBeanDescMap.get(faultDesc);
+    }
+    
+    void setFaultBeanDescMap(Map<FaultDescription, FaultBeanDesc> map) {
+        faultBeanDescMap = map;
+    }
+    
     public String toString() {
         final String newline = "\n";
+        final String sameline = " ";
         StringBuffer string = new StringBuffer();
         
         string.append(newline);
         string.append("  MarshalServiceRuntime:" + getKey());
         string.append(newline);
         string.append("    Packages = " + getPackages().toString());
+        
         for(Entry<String, AnnotationDesc> entry: this.annotationMap.entrySet()) {
             string.append(newline);
             string.append("    AnnotationDesc cached for:" + entry.getKey());
@@ -131,6 +144,29 @@
                 string.append(newline);
             }
         }
+        
+        string.append("    RequestWrappers");
+        for(Entry<OperationDescription, String> entry: this.requestWrapperMap.entrySet()) {
+            string.append(newline);
+            string.append("    Operation:" + entry.getKey().getJavaMethodName() +
+                    " RequestWrapper:" + entry.getValue());
+        }
+        
+        string.append("    ResponseWrappers");
+        for(Entry<OperationDescription, String> entry: this.responseWrapperMap.entrySet()) {
+            string.append(newline);
+            string.append("    Operation:" + entry.getKey().getJavaMethodName() +
+                    " ResponseWrapper:" + entry.getValue());
+        }
+        
+        string.append("    FaultBeanDesc");
+        for(Entry<FaultDescription, FaultBeanDesc> entry: this.faultBeanDescMap.entrySet()) {
+            string.append(newline);
+            string.append("    FaultException:" + entry.getKey().getExceptionClassName());
+            string.append(newline);
+            string.append(entry.getValue().toString());
+        }
+        
         
         return string.toString();
     }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java Mon Feb 19 15:55:03 2007
@@ -42,9 +42,11 @@
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
 import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
+import org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc;
 import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
 import org.apache.axis2.jaxws.util.WSDL4JWrapper;
 import org.apache.axis2.jaxws.util.WSDLWrapper;
+import org.apache.axis2.jaxws.utility.ClassUtils;
 import org.apache.axis2.jaxws.utility.JavaUtils;
 import org.apache.axis2.jaxws.utility.XMLRootElementUtil;
 import org.apache.axis2.jaxws.wsdl.SchemaReader;
@@ -258,9 +260,11 @@
     private static void getPackagesFromAnnotations(FaultDescription faultDesc, TreeSet<String> set, 
             MarshalServiceRuntimeDescription msrd) {
       
-      Class faultBean = loadClass(faultDesc.getFaultBean());  
+      FaultBeanDesc faultBeanDesc = msrd.getFaultBeanDesc(faultDesc);
+      String faultBeanName = faultBeanDesc.getFaultBeanClassName();
+      Class faultBean = loadClass(faultBeanName);  
       if (faultBean != null) {
-          setTypeAndElementPackages(faultBean, faultDesc.getTargetNamespace(), faultDesc.getName(), set, msrd);
+          setTypeAndElementPackages(faultBean, faultBeanDesc.getFaultBeanNamespace(), faultBeanDesc.getFaultBeanLocalName(), set, msrd);
       }
     }
     
@@ -386,9 +390,12 @@
             return null;
         }
         try {
-            
-            return forName(className, true, 
-                   getContextClassLoader());
+            // Class.forName does not support primitives
+            Class cls = ClassUtils.getPrimitiveClass(className); 
+            if (cls == null) {
+                cls = Class.forName(className, true, getContextClassLoader());   
+            } 
+            return cls;
 	        //Catch Throwable as ClassLoader can throw an NoClassDefFoundError that
 	        //does not extend Exception, so lets catch everything that extends Throwable
             //rather than just Exception.
@@ -438,8 +445,13 @@
            cl = (Class) AccessController.doPrivileged(
                    new PrivilegedExceptionAction() {
                        public Object run() throws ClassNotFoundException {
-                           return Class.forName(className, initialize, classloader);    
-                       }
+                           // Class.forName does not support primitives
+                           Class cls = ClassUtils.getPrimitiveClass(className); 
+                           if (cls == null) {
+                               cls = Class.forName(className, initialize, classloader);   
+                           } 
+                           return cls;
+                           }
                    }
                  );  
        } catch (PrivilegedActionException e) {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java Mon Feb 19 15:55:03 2007
@@ -43,6 +43,7 @@
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
 import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
+import org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc;
 import org.apache.axis2.jaxws.util.WSDL4JWrapper;
 import org.apache.axis2.jaxws.util.WSDLWrapper;
 import org.apache.axis2.jaxws.utility.ClassUtils;
@@ -142,7 +143,7 @@
        FaultDescription[] faultDescs = opDesc.getFaultDescriptions();
        if (faultDescs != null) {
            for (int i=0; i <faultDescs.length; i++) {
-               getPropertyDescMaps(faultDescs[i], map);
+               getPropertyDescMaps(faultDescs[i], ap, map);
            }
        }
        
@@ -161,11 +162,14 @@
      * @param opDesc
      * @param map
      */
-    private static void getPropertyDescMaps(FaultDescription faultDesc, Map<Class,Map<String, PropertyDescriptorPlus>> map) {
+    private static void getPropertyDescMaps(FaultDescription faultDesc, 
+            ArtifactProcessor ap, 
+            Map<Class,Map<String, PropertyDescriptorPlus>> map) {
         // TODO The property descriptors for legacy exceptions and the corresponding fault beans could be cached at this point.
         String faultDescExceptionName = faultDesc.getExceptionClassName();
         Class faultDescException = loadClass(faultDescExceptionName);
-        if (faultDescException != null && isLegacyException(faultDescException)) {
+        if (faultDescException != null && 
+                (faultDesc.getFaultInfo() == null || faultDesc.getFaultInfo().length() == 0)) {
             
             // For legacy exceptions, the fault bean is a "wrapper class" that has the same properties
             // as the exception.  To marshal an exception:
@@ -181,7 +185,8 @@
             
             // To accomplish the above marshalling and unmarshalling we need the property descriptor maps
             // for the exception and the bean.
-            String faultDescBeanName = faultDesc.getFaultBean();
+            FaultBeanDesc faultBeanDesc = ap.getFaultBeanDescMap().get(faultDesc);
+            String faultDescBeanName = faultBeanDesc.getFaultBeanClassName();
             Class faultDescBean = loadClass(faultDescBeanName);
             if (faultDescBean != null) {
                 addPropertyDesc(faultDescBeanName, map);
@@ -245,7 +250,12 @@
            cl = (Class) AccessController.doPrivileged(
                    new PrivilegedExceptionAction() {
                        public Object run() throws ClassNotFoundException {
-                           return Class.forName(className, initialize, classloader);    
+                           // Class.forName does not support primitives
+                           Class cls = ClassUtils.getPrimitiveClass(className); 
+                           if (cls == null) {
+                               cls = Class.forName(className, initialize, classloader);   
+                           } 
+                           return cls;
                        }
                    }
                  );  
@@ -281,29 +291,5 @@
        }
        
        return cl;
-   }
-   
-   /**
-    * A compliant exception has a @WebFault annotation and a getFaultInfo method.
-    * Legacy exceptions do not.
-    * @param cls
-    * @return true if legacy exception
-    * REVIEW perhaps this detection should be in FaultDescription
-    */
-   static boolean isLegacyException(Class cls) {
-       boolean legacyException = false;
-       
-       try {
-           Method getFaultInfo = cls.getMethod("getFaultInfo", null);
-       } catch (Exception e) {
-           // Failure indicates that this is not a legacy exception
-           legacyException = true;
-       }
-       if (legacyException) {
-           if (log.isDebugEnabled()) {
-               log.debug("Detected Legacy Exception = " + cls);
-           }
-       }
-       return legacyException;
    }
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/FaultDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/FaultDescription.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/FaultDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/FaultDescription.java Mon Feb 19 15:55:03 2007
@@ -42,17 +42,44 @@
  *         
  *  </pre>       
  */
+/**
+ * @author scheu
+ *
+ */
 public interface FaultDescription {
     public OperationDescription getOperationDescription();
     
     
+    
+    /**
+     * @return the name of the exception class
+     */
+    public String getExceptionClassName();
+    
+    /**
+     * @return the class that is provided via the getFaultInfo method. "" is returned if the exception 
+     * class does not provide a getFaultInfo method (such exceptions are considered non-compliant by JAX-WS).
+     */
+    public String getFaultInfo();
+    
     /**
-     * @return the name of the JAXB type defined in the schema for this exception.  Note that this is usually
-     * a bean, but it could also be a java primitive
+     * @return the name of the JAXB class defined in the schema for this exception.  Note that this is usually
+     * a bean, but it could also be a java primitive.  If not defined, the getFaultInfo type is returned.
+     * 
+     * NOTE For non-compliant exceptions, the getFaultInfo information is not availabled.  In these cases,
+     * a "" is returned.  The runtime (JAXWS) may use other information to locate and/or build the faultbean
      */
     public String getFaultBean();
+    
+    /**
+     * @return the element localname (for the JAXB class) corresponding to this exception. "" if not defined.
+     */
     public String getName();
+    
+    /**
+     * @return the element targetNamespace (for the JAXB class) corresponding to this exception. "" if not defined.
+     */
     public String getTargetNamespace();
-    public String getExceptionClassName();
+   
     
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java Mon Feb 19 15:55:03 2007
@@ -59,7 +59,6 @@
     public EndpointInterfaceDescription getEndpointInterfaceDescription();
     public FaultDescription[] getFaultDescriptions();
     public FaultDescription resolveFaultByExceptionName(String exceptionClassName);
-    public FaultDescription resolveFaultByFaultBeanName(String faultBeanName);
     public ParameterDescription getParameterDescription(int parameterNumber);
     public ParameterDescription getParameterDescription(String parameterName);
     public ParameterDescription[] getParameterDescriptions();

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java Mon Feb 19 15:55:03 2007
@@ -49,21 +49,6 @@
     static boolean isEmpty(QName qname) {
         return qname == null || isEmpty(qname.getLocalPart());
     }
-
-    /**
-     * Creat a java class name given a java method name (i.e. capitalize the first letter)
-     * @param name
-     * @return
-     */
-    static String javaMethodtoClassName(String methodName) {
-        String className = null;
-        if(methodName != null){
-            StringBuffer buildClassName = new StringBuffer(methodName);
-            buildClassName.replace(0, 1, methodName.substring(0,1).toUpperCase());
-            className = buildClassName.toString();
-        }
-        return className;
-    }
     
 	/**
 	 * @return Returns TRUE if we find just one WebMethod Annotation with exclude flag
@@ -238,61 +223,6 @@
         return protocol + "://" + sb.toString() + "/";
     }
     
-    static Class loadClass(String className)throws ClassNotFoundException {
-        // Don't make this public, its a security exposure
-        return forName(className, true, getContextClassLoader());
-    }
-    
-    /**
-     * Return the class for this name
-     * @return Class
-     */
-    static Class forName(final String className, final boolean initialize, final ClassLoader classloader) throws ClassNotFoundException {
-        // NOTE: This method must remain protected because it uses AccessController
-        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);
-            }
-            throw (ClassNotFoundException) e.getException();
-        } 
-        
-        return cl;
-    }
-    
-    /**
-     * @return ClassLoader
-     */
-    static ClassLoader getContextClassLoader() {
-        // NOTE: This method must remain private because it uses AccessController
-        ClassLoader cl = null;
-        try {
-            cl = (ClassLoader) AccessController.doPrivileged(
-                    new PrivilegedExceptionAction() {
-                        public Object run() throws ClassNotFoundException {
-                            return Thread.currentThread().getContextClassLoader();      
-                        }
-                    }
-                  );  
-        } catch (PrivilegedActionException e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Exception thrown from AccessController: " + e);
-            }
-            throw (RuntimeException) e.getException();
-        }
-        
-        return cl;
-    }
-    
-    
     /**
      * Determines whether a method should have an OperationDescription created for it
      * based on the name. This is a convenience method to allow us to exlude methods
@@ -307,55 +237,4 @@
     	return true;
     }
 
-    /**
-     * Determine the actual packager name for the generated artifacts by trying to load the class from one of two
-     * packages.  This is necessary because the RI implementations of WSGen and WSImport generate the artifacts 
-     * in different packages:
-     * - WSImport generates the artifacts in the same package as the SEI
-     * - WSGen generates the artifacts in a "jaxws" sub package under the SEI package.
-     * Note that from reading the JAX-WS spec, it seems that WSGen is doing that correctly; See
-     * the conformance requirement in JAX-WS 2.0 Spec Section 3.6.2.1 Document Wrapped on page 36:
-     *     Conformance (Default wrapper bean package): In the absence of customizations, the wrapper beans package
-     *     MUST be a generated jaxws subpackage of the SEI package.
-     *                         ^^^^^^^^^^^^^^^^
-     * @param requestWrapperClassName
-     * @return
-     */
-    static final String JAXWS_SUBPACKAGE = "jaxws";
-    static String determineActualAritfactPackage(String wrapperClassName) {
-        String returnWrapperClassName = null;
-        if (wrapperClassName == null) {
-            return returnWrapperClassName;
-        }
-    
-        // Try to load the class that was passed in
-        try {
-            loadClass(wrapperClassName);
-            returnWrapperClassName = wrapperClassName;
-        }
-        catch (ClassNotFoundException e) {
-            // Couldn't load the class; we'll try another one below.
-        }
-    
-        // If the original class couldn't be loaded, try adding ".jaxws." to the package
-        if (returnWrapperClassName == null) {
-            String originalPackage = getJavaPackageName(wrapperClassName);
-            if (originalPackage != null) {
-                String alternatePackage = originalPackage + "." + DescriptionUtils.JAXWS_SUBPACKAGE;
-                String className = getSimpleJavaClassName(wrapperClassName);
-                String alternateWrapperClass = alternatePackage + "." + className;
-                try {
-                    loadClass(alternateWrapperClass);
-                    returnWrapperClassName = alternateWrapperClass;
-                }
-                catch (ClassNotFoundException e) {
-                    // Couldn't load the class
-                }
-            }
-        }
-
-        return returnWrapperClassName;
-    }
-
-    
 }

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/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- 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 Mon Feb 19 15:55:03 2007
@@ -17,6 +17,8 @@
 package org.apache.axis2.jaxws.description.impl;
 
 import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -448,8 +450,8 @@
     			else { 
     				try {
     					// TODO: Using Class forName() is probably not the best long-term way to get the SEI class from the annotation
-    					seiClass = DescriptionUtils.forName(seiClassName, false, 
-                                DescriptionUtils.getContextClassLoader());
+    					seiClass = forName(seiClassName, false, 
+                                getContextClassLoader());
     			    // Catch Throwable as ClassLoader can throw an NoClassDefFoundError that
     			    // does not extend Exception, so lets catch everything that extends Throwable
                     // rather than just Exception.
@@ -1448,6 +1450,55 @@
             }
     	}
     	return wsdlComposite;
+    }
+    
+    /**
+     * Return the class for this name
+     * @return Class
+     */
+    private static Class forName(final String className, final boolean initialize, final ClassLoader classloader) throws ClassNotFoundException {
+        // NOTE: This method must remain protected because it uses AccessController
+        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);
+            }
+            throw (ClassNotFoundException) e.getException();
+        } 
+        
+        return cl;
+    }
+    
+    /**
+     * @return ClassLoader
+     */
+    private static ClassLoader getContextClassLoader() {
+        // NOTE: This method must remain private because it uses AccessController
+        ClassLoader cl = null;
+        try {
+            cl = (ClassLoader) AccessController.doPrivileged(
+                    new PrivilegedExceptionAction() {
+                        public Object run() throws ClassNotFoundException {
+                            return Thread.currentThread().getContextClassLoader();      
+                        }
+                    }
+                  );  
+        } catch (PrivilegedActionException e) {
+            if (log.isDebugEnabled()) {
+                log.debug("Exception thrown from AccessController: " + e);
+            }
+            throw (RuntimeException) e.getException();
+        }
+        
+        return cl;
     }
     
     public String toString() {

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java Mon Feb 19 15:55:03 2007
@@ -51,6 +51,7 @@
     private String name = "";  // WebFault.name
     private String faultBean = "";  // WebFault.faultBean
     private String targetNamespace = ""; // WebFault.targetNamespace
+    private String faultInfo = null;
     
     private static final String FAULT = "Fault";
 
@@ -88,6 +89,40 @@
         return annotation;
     }
 
+    public String getExceptionClassName() {
+        if (!isDBC()) {
+            // no need for defaults here.  The exceptionClass stored in this
+            // FaultDescription object is one that has been declared to be
+            // thrown from the service method
+            return exceptionClass.getCanonicalName();
+        } else {
+            return composite.getClassName();
+        }
+    }
+    
+    public String getFaultInfo() {
+        if (faultInfo != null) {
+            return faultInfo;
+        }
+        if (!isDBC()) {
+            try {
+                Method method = exceptionClass.getMethod("getFaultInfo", null);
+                faultInfo = method.getReturnType().getCanonicalName();
+            } catch (Exception e) {
+                // This must be a legacy exception
+                faultInfo = "";
+            } 
+        } else {
+            MethodDescriptionComposite mdc = 
+                composite.getMethodDescriptionComposite("getFaultInfo", 1);
+            if (mdc != null) {
+                faultInfo = mdc.getReturnType();
+            } else {
+                faultInfo = "";
+            }
+        }
+        return faultInfo;
+    }
     
     public String getFaultBean() {
         if (faultBean != null && faultBean.length() > 0) {
@@ -102,40 +137,12 @@
                 annotation.faultBean().length() > 0) {
                 faultBean = annotation.faultBean();
             } else {
-                // We don't have a faultBean. Try looking at the getFaultInfo method.
-                if (!isDBC()) {
-                    try {
-                        Method method = exceptionClass.getMethod("getFaultInfo", null);
-                        faultBean = method.getReturnType().getCanonicalName();
-                    } catch (Exception e) {
-                        // This must be a legacy exception
-                    }
-                }  else {
-                    MethodDescriptionComposite mdc = 
-                        composite.getMethodDescriptionComposite("getFaultInfo", 1);
-                    if (mdc != null) {
-                        faultBean = mdc.getReturnType();
-                    }
-                }
+                // There is no default.  But it seems reasonable to return
+                // the fault info type.
+                faultBean = getFaultInfo();
                 
-                // Still not found, this must be a non-compliant exception.
-                // Use the JAX-WS chap 3.7 algorithm
-                if (faultBean != null && faultBean.length() <= 0) {
-                    String simpleName = getSimpleName(getExceptionClassName()) + "Bean";
-                    String packageName = null;
-                    if (!isDBC()) {
-                        Class clazz = getOperationDescription().getSEIMethod().getDeclaringClass();
-                        packageName = clazz.getPackage().getName();
-                    } else {
-                        // Similar algorithm as the OperationDesc RequestWrapper and ResponseWrapper
-                        String declaringClazz = ((OperationDescriptionImpl )getOperationDescription()).getMethodDescriptionComposite().getDeclaringClass();
-                        packageName = declaringClazz.substring(0, declaringClazz.lastIndexOf("."));
-                    }
-                    faultBean = packageName + "." + simpleName;
-                    
-                    // The following call adjusts the package name if necessary
-                    faultBean = DescriptionUtils.determineActualAritfactPackage(faultBean);
-                }
+                // The faultBean still may be "" at this point.  The JAXWS runtime
+                // is responsible for finding/buildin a representative fault bean.
             }
         }
         return faultBean;
@@ -151,16 +158,8 @@
                 annotation.name().length() > 0) {
                 name = annotation.name();
             } else {
-                // The default is the name on the @XmlRootElement of the FaultBean since this
-                // is what is flowed over the wire.
-                try {
-                    Class clazz = DescriptionUtils.loadClass(getFaultBean());
-                    XmlRootElement root = (XmlRootElement) clazz.getAnnotation(XmlRootElement.class);
-                    name = root.name();
-                } catch (Exception e) {
-                    // All else fails use the faultBean name
-                    name = getSimpleName(getFaultBean());
-                }
+                // The default is undefined.
+                // The JAX-WS layer may use the fault bean information to determine the name
             }
         }
         return name;
@@ -176,30 +175,14 @@
                 annotation.targetNamespace().length() > 0) {
                 targetNamespace = annotation.targetNamespace();
             } else {
-                // The default is the namespace on the @XmlRootElement of the FaultBean since this
-                // is what is flowed over the wire.
-                try {
-                    Class clazz = DescriptionUtils.loadClass(getFaultBean());
-                    targetNamespace = getXmlRootElementQName(clazz).getNamespaceURI();
-                } catch (Exception e) {
-                    // All else fails use the faultBean to calculate a namespace
-                    targetNamespace = makeNamespace(getFaultBean());
-                }
+                // The default is undefined
+                // The JAX-WS layer may use the fault bean information to determine the name
             }
         }
         return targetNamespace;
     }
 
-    public String getExceptionClassName() {
-    	if (!isDBC()) {
-    		// no need for defaults here.  The exceptionClass stored in this
-    		// FaultDescription object is one that has been declared to be
-    		// thrown from the service method
-    		return exceptionClass.getCanonicalName();
-    	} else {
-    		return composite.getClassName();
-    	}
-    }
+    
 
     public OperationDescription getOperationDescription() {
         return parent;
@@ -225,33 +208,6 @@
         return out;
     }
     
-    private static String makeNamespace(String packageAndClassname) {
-        if (packageAndClassname == null || packageAndClassname.length() == 0) {
-            return null;
-        }
-        StringTokenizer tokenizer = new StringTokenizer(packageAndClassname, ".");
-        String[] tokens;
-        if (tokenizer.countTokens() == 0) {
-            tokens = new String[0];
-        } else {
-            // -1 to skip the classname
-            tokens = new String[tokenizer.countTokens()-1];
-            // -2 to skip the classname
-            for (int i=tokenizer.countTokens()-2; i >= 0; i--) {
-                tokens[i] = tokenizer.nextToken();
-            }
-        }
-        StringBuffer namespace = new StringBuffer("http://");
-        String dot = "";
-        for (int i=0; i<tokens.length; i++) {
-            if (i==1)
-                dot = ".";
-            namespace.append(dot+tokens[i]);
-        }
-        namespace.append('/');
-        return namespace.toString();
-    }
-    
     private boolean isDBC() {
     	if (this.composite != null)
     		return true;
@@ -264,42 +220,20 @@
         final String sameline = "; ";
         StringBuffer string = new StringBuffer();
 
+        
         string.append(super.toString());
         string.append(newline);
+        string.append("Exception class: " + getExceptionClassName());
+        string.append(newline);
         string.append("Name: " + getName());
         string.append(newline);
-        string.append("Fault Bean: " + getFaultBean());
+        string.append("Namespace: " + getName());
         string.append(newline);
-        string.append("Exception class: " + getExceptionClassName());
-        
-        return string.toString();
-    }
-    
-    /**
-     * @param clazz
-     * @return namespace of root element qname or null if this is not object does not represent a root element
-     */
-    static QName getXmlRootElementQName(Class clazz){
-            
-        // See if the object represents a root element
-        XmlRootElement root = (XmlRootElement) clazz.getAnnotation(XmlRootElement.class);
-        if (root == null) {
-            return null;
-        }
+        string.append("FaultBean: " + getFaultBean());
+        string.append(newline);
+        string.append("FaultInfo Type Name  : " + getFaultInfo());
         
-        String namespace = root.namespace();
-        String localPart = root.name();
         
-        // The namespace may need to be defaulted
-        if (namespace == null || namespace.length() == 0 || namespace.equals("##default")) {
-            Package pkg = clazz.getPackage();
-            XmlSchema schema = (XmlSchema) pkg.getAnnotation(XmlSchema.class);
-            if (schema != null) {
-                namespace = schema.namespace();
-            } else {
-                return null;
-            }
-        }
-        return new QName(namespace, localPart);
+        return string.toString();
     }
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Mon Feb 19 15:55:03 2007
@@ -801,16 +801,6 @@
         return faultDescriptions;
     }
     
-    public FaultDescription resolveFaultByFaultBeanName(String faultBeanName) {
-        if (faultDescriptions != null) {
-            for(FaultDescription fd: faultDescriptions) {
-                if (faultBeanName.equals(fd.getFaultBean()))
-                    return fd;
-            }
-        }
-        return null;
-    }
-    
     public FaultDescription resolveFaultByExceptionName(String exceptionClassName) {
         if (faultDescriptions != null) {
             for(FaultDescription fd: faultDescriptions) {
@@ -1448,6 +1438,8 @@
         string.append(sameline);
         string.append("Response Wrapper class: " + getResponseWrapperClassName());
         //
+        string.append(newline);
+        string.append("Java declaring class name: " + getJavaDeclaringClassName());
         string.append(newline);
         string.append("Java method name: " + getJavaMethodName());
         string.append(newline);

Modified: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/WrapperPackageTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/WrapperPackageTests.java?view=diff&rev=509388&r1=509387&r2=509388
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/WrapperPackageTests.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/WrapperPackageTests.java Mon Feb 19 15:55:03 2007
@@ -71,7 +71,9 @@
         String faultExceptionClass = fDesc.getExceptionClassName();
         assertEquals("org.apache.axis2.jaxws.description.SubPackageException", faultExceptionClass);
         String faultBeanClass = fDesc.getFaultBean();
-        assertEquals("org.apache.axis2.jaxws.description.jaxws.SubPackageExceptionBean", faultBeanClass);
+        // Due to the missing getFaultInfo, the runtime must find or build a fault bean.
+        assertEquals("", faultBeanClass);
+        //assertEquals("org.apache.axis2.jaxws.description.jaxws.SubPackageExceptionBean", faultBeanClass);
 
     }
     



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