You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2008/04/17 02:14:40 UTC

svn commit: r648902 [2/2] - in /webservices/axis2/branches/java/1_4/modules: adb-codegen/src/org/apache/axis2/schema/writer/ adb-codegen/test/org/apache/axis2/schema/populate/ adb-codegen/test/org/apache/axis2/schema/populate/derived/ adb-codegen/test/...

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java Wed Apr 16 17:14:31 2008
@@ -223,7 +223,8 @@
             // Create an Attachment object with the signature value
             Attachment attachment = new Attachment(value, 
                                                    formalType, 
-                                                   attachmentDesc);  
+                                                   attachmentDesc,
+                                                   pd.getPartName());
             pde = new PDElement(pd, 
                     null, // For SWA Attachments, there is no element reference to the attachment
                     null, 
@@ -338,7 +339,22 @@
                 } else {
                     // Attachment Processing
                     if (attachmentDesc.getAttachmentType() == AttachmentType.SWA) {
-                        String cid = message.getAttachmentID(swaIndex);
+                        String partName = pd.getPartName();
+                        String cid = null;
+                        if (log.isDebugEnabled()) {
+                            log.debug("Getting the attachment dataHandler for partName=" + partName);
+                        }
+                        if (partName != null && partName.length() > 0) {
+                            // Compliant WS-I behavior
+                            cid = message.getAttachmentID(partName);
+                        }
+                        if (cid == null) {
+                            if (log.isDebugEnabled()) {
+                                log.debug("Attachment dataHandler was not found.  Fallback to use attachment " + swaIndex);
+                            }
+                            // Toleration mode for non-compliant attachment names
+                            cid = message.getAttachmentID(swaIndex);
+                        }
                         DataHandler dh = message.getDataHandler(cid);
                         Attachment attachment = new Attachment(dh, cid);
                         PDElement pde = new PDElement(pd, null, null, attachment);
@@ -969,7 +985,12 @@
             JAXBBlockContext blockContext = new JAXBBlockContext(marshalDesc.getPackages());
 
             // Note that faultBean may not be a bean, it could be a primitive 
-            Class faultBeanFormalClass = loadClass(faultBeanDesc.getFaultBeanClassName());
+            Class faultBeanFormalClass;
+            try {
+                faultBeanFormalClass = loadClass(faultBeanDesc.getFaultBeanClassName());
+            } catch (ClassNotFoundException e){
+                faultBeanFormalClass = loadClass(faultBeanDesc.getFaultBeanClassName(), operationDesc.getEndpointInterfaceDescription().getEndpointDescription().getAxisService().getClassLoader());
+            }
 
             // Use "by java type" marshalling if necessary
             if (blockContext.getConstructionType() != 
@@ -993,7 +1014,12 @@
             }
 
             // Construct the JAX-WS generated exception that holds the faultBeanObject
-            Class exceptionClass = loadClass(faultDesc.getExceptionClassName());
+            Class exceptionClass;
+            try {
+                exceptionClass = loadClass(faultDesc.getExceptionClassName());
+            } catch (ClassNotFoundException e){
+                exceptionClass = loadClass(faultDesc.getExceptionClassName(), operationDesc.getEndpointInterfaceDescription().getEndpointDescription().getAxisService().getClassLoader());
+            }
             if (log.isErrorEnabled()) {
                 log.debug("Found FaultDescription.  The exception name is " +
                         exceptionClass.getName());
@@ -1082,12 +1108,27 @@
     }
 
     /**
+     * Load the class
+     *
+     * @param className
+     * @return loaded class
+     * @throws ClassNotFoundException
+     */
+    static Class loadClass(String className, ClassLoader cl) throws ClassNotFoundException {
+        // Don't make this public, its a security exposure
+        Class cls = ClassUtils.getPrimitiveClass(className);
+        if (cls == null) {
+            cls = forName(className, true, cl);
+        }
+        return cls;
+    }
+    /**
      * Return the class for this name
      *
      * @return Class
      */
     private static Class forName(final String className, final boolean initialize,
-                                 final ClassLoader classLoader) {
+                                 final ClassLoader classLoader) throws ClassNotFoundException {
         // NOTE: This method must remain private because it uses AccessController
         Class cl = null;
         try {
@@ -1107,7 +1148,7 @@
             if (log.isDebugEnabled()) {
                 log.debug("Exception thrown from AccessController: " + e);
             }
-            throw ExceptionFactory.makeWebServiceException(e.getException());
+            throw (ClassNotFoundException) e.getException();
         }
 
         return cl;

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java Wed Apr 16 17:14:31 2008
@@ -309,7 +309,8 @@
                         // Create an Attachment object with the signature value
                         Attachment attachment = new Attachment(returnObject, 
                                                                returnType, 
-                                                               attachmentDesc);  
+                                                               attachmentDesc,
+                                                               operationDesc.getResultPartName());
                         m.addDataHandler(attachment.getDataHandler(), 
                                          attachment.getContentID());
                         m.setDoingSWA(true);

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java Wed Apr 16 17:14:31 2008
@@ -77,6 +77,14 @@
     public String getAttachmentID(int index);
     
     /**
+     * Get the indicated (non-soap part) attachment id
+     * @param partName (WS-I indicates that SWA attachments have a partName prefix)
+     * @return CID or null if not present
+     */
+    public String getAttachmentID(String partName);
+    
+    
+    /**
      * Get the attachment identified by the contentID 
      * @param cid
      * @return

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java Wed Apr 16 17:14:31 2008
@@ -158,16 +158,16 @@
         Map<String, JAXBContextValue> innerMap = null;
         innerMap = getInnerMap(cacheKey, cl);
         if (innerMap == null) {
-        	synchronized(jaxbMap) {
-        		innerMap = getInnerMap(cacheKey, cl);
-        		if(innerMap==null) {
-        			adjustPoolSize(jaxbMap);
-        			innerMap = new ConcurrentHashMap<String, JAXBContextValue>();
-                    if(cacheKey != null) {
+            synchronized(jaxbMap) {
+                innerMap = getInnerMap(cacheKey, cl);
+                if(innerMap==null) {
+                    adjustPoolSize(jaxbMap);
+                    innerMap = new ConcurrentHashMap<String, JAXBContextValue>();
+                    if (cacheKey != null) {
                         jaxbMap.put(cacheKey, innerMap);
                     }
                 }
-        	}
+            }
         }
 
         if (contextPackages == null) {
@@ -176,19 +176,19 @@
 
         JAXBContextValue contextValue = innerMap.get(key);
         if (contextValue == null) {
-        	synchronized (innerMap) {
-        		contextValue = innerMap.get(key);
-        		if(contextValue==null) {
-        			adjustPoolSize(innerMap);
-        			
-        			// Create a copy of the contextPackages.  This new TreeSet will
-        			// contain only the valid contextPackages.
-        			// Note: The original contextPackage set is accessed by multiple 
-        			// threads and should not be altered.
-        			
-        			TreeSet<String> validContextPackages = new TreeSet<String>(contextPackages);  
-        			contextValue = createJAXBContextValue(validContextPackages, cl);
-                    
+            synchronized (innerMap) {
+                contextValue = innerMap.get(key);
+                if(contextValue==null) {
+                    adjustPoolSize(innerMap);
+
+                    // Create a copy of the contextPackages.  This new TreeSet will
+                    // contain only the valid contextPackages.
+                    // Note: The original contextPackage set is accessed by multiple 
+                    // threads and should not be altered.
+
+                    TreeSet<String> validContextPackages = new TreeSet<String>(contextPackages);  
+                    contextValue = createJAXBContextValue(validContextPackages, cl);
+
                     // If we don't get all the classes, try the cached classloader 
                     if (cacheKey != null && validContextPackages.size() != contextPackages.size()) {
                         validContextPackages = new TreeSet<String>(contextPackages);
@@ -196,15 +196,15 @@
                     }
 
                     // Put the new context in the map keyed by both the original and valid list of packages
-        			String validPackagesKey = validContextPackages.toString();
-        			innerMap.put(key, contextValue);
-        			innerMap.put(validPackagesKey, contextValue);
-        			if (log.isDebugEnabled()) {
-        				log.debug("JAXBContext [created] for " + key);
-        				log.debug("JAXBContext also stored by the list of valid packages:" + validPackagesKey);
-        			}
-        		}
-			}
+                    String validPackagesKey = validContextPackages.toString();
+                    innerMap.put(key, contextValue);
+                    innerMap.put(validPackagesKey, contextValue);
+                    if (log.isDebugEnabled()) {
+                        log.debug("JAXBContext [created] for " + key);
+                        log.debug("JAXBContext also stored by the list of valid packages:" + validPackagesKey);
+                    }
+                }
+            }
         } else {
             if (log.isDebugEnabled()) {
                 log.debug("JAXBContext [from pool] for " + key);
@@ -214,23 +214,23 @@
         return contextValue.jaxbContext;
     }
 
-	private static Map<String, JAXBContextValue> getInnerMap(ClassLoader cacheKey, ClassLoader cl) {
-		Map<String, JAXBContextValue> innerMap;
-		if(cacheKey != null) {
+    private static Map<String, JAXBContextValue> getInnerMap(ClassLoader cacheKey, ClassLoader cl) {
+        Map<String, JAXBContextValue> innerMap;
+        if(cacheKey != null) {
             if(log.isDebugEnabled()) {
                 log.debug("Using supplied classloader to retrieve JAXBContext: " + 
-                        cacheKey);
+                          cacheKey);
             }
             innerMap = jaxbMap.get(cacheKey);
         }else {
             if(log.isDebugEnabled()) {
                 log.debug("Using classloader from Thread to retrieve JAXBContext: " + 
-                        cl);
+                          cl);
             }
             innerMap = jaxbMap.get(cl);
         }
-		return innerMap;
-	}
+        return innerMap;
+    }
 
     /**
      * Create a JAXBContext using the contextPackages
@@ -245,10 +245,13 @@
 
         JAXBContextValue contextValue = null;
         if (log.isDebugEnabled()) {
+            
             log.debug("Following packages are in this batch of getJAXBContext() :");
+            
             for (String pkg : contextPackages) {
                 log.debug(pkg);
             }
+            log.debug("This classloader will be used to construct the JAXBContext" + cl);
         }
         // The contextPackages is a set of package names that are constructed using PackageSetBuilder.
         // PackageSetBuilder gets the packages names from various sources.
@@ -381,7 +384,7 @@
             //Lets add all common array classes
             addCommonArrayClasses(fullList);
             Class[] classArray = fullList.toArray(new Class[0]);
-            JAXBContext context = JAXBContext_newInstance(classArray);
+            JAXBContext context = JAXBContext_newInstance(classArray, cl);
             if (context != null) {
                 contextValue = new JAXBContextValue(context, CONSTRUCTION_TYPE.BY_CLASS_ARRAY);
             }
@@ -635,7 +638,9 @@
 
         try {
             // This will load classes from directory
-            classes.addAll(getClassesFromDirectory(pkg, cl));
+            List<Class> classesFromDir = getClassesFromDirectory(pkg, cl);
+            checkClasses(classesFromDir, pkg);
+            classes.addAll(classesFromDir);
         } catch (ClassNotFoundException e) {
             if (log.isDebugEnabled()) {
                 log.debug("getClassesFromDirectory failed to get Classes");
@@ -648,7 +653,11 @@
                 ClassFinderFactory cff =
                         (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
                 ClassFinder cf = cff.getClassFinder();
-                classes.addAll(cf.getClassesFromJarFile(pkg, cl));
+                
+                List<Class> classesFromJar = cf.getClassesFromJarFile(pkg, cl);
+                
+                checkClasses(classesFromJar, pkg);
+                classes.addAll(classesFromJar);
             }
         } catch (ClassNotFoundException e) {
             if (log.isDebugEnabled()) {
@@ -658,6 +667,32 @@
 
         return classes;
     }
+    
+    /**
+     * @param list
+     * @param pkg
+     */
+    private static void checkClasses(List<Class> list, String pkg) {
+        // The installed classfinder or directory search may inadvertently add too many 
+        // classes.  This rountine is a 'double check' to make sure that the classes
+        // are acceptable.
+        for (int i=0; i<list.size();) {
+            Class cls = list.get(i);
+            if (!cls.isInterface() &&
+                ClassUtils.getDefaultPublicConstructor(cls) != null &&
+               !ClassUtils.isJAXWSClass(cls) &&
+               cls.getPackage().getName().equals(pkg)) {
+                i++; // Acceptable class
+            } else {
+                if (log.isDebugEnabled()) {
+                    log.debug("Removing class " + cls + " from consideration because it is not in package " + pkg +
+                              " or is an interface or does not have a public constructor or is" +
+                              " a jaxws class");
+                }
+                list.remove(i);
+            }
+        }
+    }
 
     private static ArrayList<Class> getClassesFromDirectory(String pkg, ClassLoader cl)
             throws ClassNotFoundException {
@@ -892,10 +927,12 @@
      * Create JAXBContext from Class[]
      *
      * @param classArray
+     * @param cl ClassLoader that loaded the classes
      * @return
      * @throws Exception
      */
-    private static JAXBContext JAXBContext_newInstance(final Class[] classArray)
+    private static JAXBContext JAXBContext_newInstance(final Class[] classArray, 
+                                                       final ClassLoader cl)
             throws JAXBException {
         // NOTE: This method must remain private because it uses AccessController
         JAXBContext jaxbContext = null;
@@ -911,7 +948,17 @@
             jaxbContext = (JAXBContext)AccessController.doPrivileged(
                     new PrivilegedExceptionAction() {
                         public Object run() throws JAXBException {
-                            return JAXBContext.newInstance(classArray);
+                            // Unlike the JAXBContext.newInstance(Class[]) method
+                            // does now accept a classloader.  To workaround this
+                            // issue, the classloader is temporarily changed to cl
+                            Thread currentThread = Thread.currentThread();
+                            ClassLoader savedClassLoader = currentThread.getContextClassLoader();
+                            try {
+                                currentThread.setContextClassLoader(cl);
+                                return JAXBContext.newInstance(classArray);
+                            } finally {
+                                currentThread.setContextClassLoader(savedClassLoader);
+                            }
                         }
                     }
             );

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/ClassFinderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/ClassFinderImpl.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/ClassFinderImpl.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/ClassFinderImpl.java Wed Apr 16 17:14:31 2008
@@ -79,7 +79,8 @@
                                             // Don't add any interfaces or JAXWS specific classes.
                                             // Only classes that represent data and can be marshalled
                                             // by JAXB should be added.
-                                            if (!clazz.isInterface()
+                                            if (!clazz.isInterface() &&
+                                                    clazz.getPackage().getName().equals(pkg)
                                                     && ClassUtils
                                                     .getDefaultPublicConstructor(clazz) != null
                                                     && !ClassUtils.isJAXWSClass(clazz)) {

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java Wed Apr 16 17:14:31 2008
@@ -289,6 +289,21 @@
         return resultCID;
     }
     
+
+    public String getAttachmentID(String partName) {
+        // Find the prefix that starts with the 
+        // partName=
+        String prefix = partName + "=";
+        List<String> cids = getAttachmentIDs();
+        for (String cid: cids) {
+            if (cid.startsWith(prefix)) {
+                return cid;
+            }
+        }
+        return null;
+    }
+
+    
     private String getSOAPPartContentID() {
         String contentID = null;
         if (messageContext == null) {

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java Wed Apr 16 17:14:31 2008
@@ -88,15 +88,19 @@
                                            Map<String, AnnotationDesc> map) {
         String implClassName = getServiceImplClassName(endpointDesc);
         if (implClassName != null) {
-            Class clz = loadClass(implClassName);
+            Class clz;
+            clz = loadClass(implClassName);
+            if(clz == null){
+                clz = loadClass(implClassName, endpointDesc.getAxisService().getClassLoader());
+            }
             if (clz != null) {
-                addAnnotation(clz, map);
+                addAnnotation(endpointDesc, clz, map);
             }
         }
         EndpointInterfaceDescription endpointInterfaceDesc =
                 endpointDesc.getEndpointInterfaceDescription();
         if (endpointInterfaceDesc != null) {
-            getAnnotationDescs(endpointInterfaceDesc, ap, map);
+            getAnnotationDescs(endpointDesc, endpointInterfaceDesc, ap, map);
         }
     }
 
@@ -106,12 +110,13 @@
      * @param ap                    ArtifactProcessor which found/produced artifact classes
      * @param map
      */
-    private static void getAnnotationDescs(EndpointInterfaceDescription endpointInterfaceDesc,
+    private static void getAnnotationDescs(EndpointDescription endpointDesc, 
+                                           EndpointInterfaceDescription endpointInterfaceDesc,
                                            ArtifactProcessor ap,
                                            Map<String, AnnotationDesc> map) {
         Class clz = endpointInterfaceDesc.getSEIClass();
         if (clz != null) {
-            addAnnotation(clz, map);
+            addAnnotation(endpointDesc, clz, map);
         }
         
         // Don't dig into the async operations
@@ -120,7 +125,7 @@
         // Build a set of packages from all of the opertions
         if (opDescs != null) {
             for (int i = 0; i < opDescs.length; i++) {
-                getAnnotationDescs(opDescs[i], ap, map);
+                getAnnotationDescs(endpointDesc, opDescs[i], ap, map);
             }
         }
     }
@@ -133,7 +138,8 @@
      * @param ap     ArtifactProcessor which found/produced artifact classes
      * @param map
      */
-    private static void getAnnotationDescs(OperationDescription opDesc,
+    private static void getAnnotationDescs(EndpointDescription endpointDesc,
+                                           OperationDescription opDesc,
                                            ArtifactProcessor ap,
                                            Map<String, AnnotationDesc> map) {
 
@@ -141,7 +147,7 @@
         ParameterDescription[] parameterDescs = opDesc.getParameterDescriptions();
         if (parameterDescs != null) {
             for (int i = 0; i < parameterDescs.length; i++) {
-                getAnnotationDescs(parameterDescs[i], map);
+                getAnnotationDescs(endpointDesc, parameterDescs[i], map);
             }
         }
 
@@ -149,36 +155,37 @@
         FaultDescription[] faultDescs = opDesc.getFaultDescriptions();
         if (faultDescs != null) {
             for (int i = 0; i < faultDescs.length; i++) {
-                getAnnotationDescs(faultDescs[i], ap, map);
+                getAnnotationDescs(endpointDesc, faultDescs[i], ap, map);
             }
         }
 
         // Also consider the request and response wrappers
         String wrapperName = ap.getRequestWrapperMap().get(opDesc);
         if (wrapperName != null) {
-            addAnnotation(wrapperName, map);
+            addAnnotation(endpointDesc, wrapperName, map);
         }
         wrapperName = ap.getResponseWrapperMap().get(opDesc);
         if (wrapperName != null) {
-            addAnnotation(wrapperName, map);
+            addAnnotation(endpointDesc, wrapperName, map);
         }
 
         // Finally consider the result type
         Class cls = opDesc.getResultActualType();
         if (cls != null && cls != void.class && cls != Void.class) {
-            addAnnotation(cls, map);
+            addAnnotation(endpointDesc, cls, map);
         }
     }
 
 
-    private static void getAnnotationDescs(ParameterDescription paramDesc,
+    private static void getAnnotationDescs(EndpointDescription endpointDesc,
+                                           ParameterDescription paramDesc,
                                            Map<String, AnnotationDesc> map) {
 
         // Get the type that defines the actual data.  (this is never a holder )
         Class paramClass = paramDesc.getParameterActualType();
 
         if (paramClass != null) {
-            getTypeAnnotationDescs(paramClass, map);
+            getTypeAnnotationDescs(endpointDesc, paramClass, map);
         }
 
     }
@@ -189,13 +196,17 @@
      * @param faultDesc FaultDescription
      * @param set       Set<Package> that is updated
      */
-    private static void getAnnotationDescs(FaultDescription faultDesc,
+    private static void getAnnotationDescs(EndpointDescription endpointDesc, 
+                                           FaultDescription faultDesc,
                                            ArtifactProcessor ap,
                                            Map<String, AnnotationDesc> map) {
         FaultBeanDesc faultBeanDesc = ap.getFaultBeanDescMap().get(faultDesc);
         Class faultBean = loadClass(faultBeanDesc.getFaultBeanClassName());
+        if(faultBean == null) {
+            faultBean = loadClass(faultBeanDesc.getFaultBeanClassName(), endpointDesc.getAxisService().getClassLoader());    
+        }
         if (faultBean != null) {
-            getTypeAnnotationDescs(faultBean, map);
+            getTypeAnnotationDescs(endpointDesc, faultBean, map);
         }
     }
 
@@ -206,13 +217,13 @@
      *
      * @param cls
      */
-    private static void getTypeAnnotationDescs(Class cls, Map<String, AnnotationDesc> map) {
+    private static void getTypeAnnotationDescs(EndpointDescription endpointDesc, Class cls, Map<String, AnnotationDesc> map) {
 
         if (JAXBElement.class.isAssignableFrom(cls)) {
             try {
                 Method m = cls.getMethod("getValue", noClass);
                 Class cls2 = m.getReturnType();
-                addAnnotation(cls2, map);
+                addAnnotation(endpointDesc, cls2, map);
 
             } catch (Exception e) {
                 // We should never get here
@@ -221,21 +232,24 @@
                 }
             }
         } else {
-            addAnnotation(cls, map);
+            addAnnotation(endpointDesc, cls, map);
         }
     }
 
-    private static void addAnnotation(String className, Map<String, AnnotationDesc> map) {
+    private static void addAnnotation(EndpointDescription endpointDesc, String className, Map<String, AnnotationDesc> map) {
 
         if (map.get(className) == null) {
             Class clz = loadClass(className);
+            if (clz == null) {
+                clz = loadClass(className, endpointDesc.getAxisService().getClassLoader());    
+            }
             if (clz != null) {
-                addAnnotation(clz, map);
+                addAnnotation(endpointDesc, clz, map);
             }
         }
     }
 
-    private static void addAnnotation(Class cls, Map<String, AnnotationDesc> map) {
+    private static void addAnnotation(EndpointDescription endpointDesc, Class cls, Map<String, AnnotationDesc> map) {
 
         String className = cls.getCanonicalName();
         if (map.get(className) == null) {
@@ -258,11 +272,38 @@
             Class[] interfaces = cls.getInterfaces();
             if (interfaces != null) {
                 for (int i=0; i<interfaces.length; i++) {
-                    addAnnotation(interfaces[i], map);
+                    addAnnotation(endpointDesc, interfaces[i], map);
                 }
             }
             
         }
+    }
+
+    /**
+     * Loads the class
+     *
+     * @param className
+     * @return Class (or null if the class cannot be loaded)
+     */
+    private static Class loadClass(String className, ClassLoader loader) {
+        // Don't make this public, its a security exposure
+        if (className == null || className.length() == 0) {
+            return null;
+        }
+        try {
+
+            return forName(className, true,
+                           loader);
+            //Catch Throwable as ClassLoader can throw an NoClassDefFoundError that
+            //does not extend Exception, so lets catch everything that extends Throwable
+            //rather than just Exception.
+        } catch (Throwable e) {
+            // TODO Should the exception be swallowed ?
+            if (log.isDebugEnabled()) {
+                log.debug("PackageSetBuilder cannot load the following class:" + className);
+            }
+        }
+        return null;
     }
 
     /**

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Wed Apr 16 17:14:31 2008
@@ -103,6 +103,9 @@
                     }
                     String foundRequestWrapperName = findArtifact(requestWrapperName);
                     if (foundRequestWrapperName == null) {
+                        foundRequestWrapperName = findArtifact(requestWrapperName, ed.getAxisService().getClassLoader());
+                    }
+                    if (foundRequestWrapperName == null) {
                         foundRequestWrapperName = missingArtifact(requestWrapperName);
                     }
                     if (foundRequestWrapperName != null) {
@@ -121,6 +124,9 @@
                     }
                     String foundResponseWrapperName = findArtifact(responseWrapperName);
                     if (foundResponseWrapperName == null) {
+                        foundResponseWrapperName = findArtifact(responseWrapperName, ed.getAxisService().getClassLoader());
+                    }
+                    if (foundResponseWrapperName == null) {
                         foundResponseWrapperName = missingArtifact(responseWrapperName);
                     }
                     if (foundResponseWrapperName != null) {
@@ -128,7 +134,7 @@
                     }
 
                     for (FaultDescription faultDesc : opDesc.getFaultDescriptions()) {
-                        FaultBeanDesc faultBeanDesc = create(faultDesc, opDesc);
+                        FaultBeanDesc faultBeanDesc = create(ed, faultDesc, opDesc);
                         faultBeanDescMap.put(faultDesc, faultBeanDesc);
                     }
                 }
@@ -136,7 +142,7 @@
         }
     }
 
-    private FaultBeanDesc create(FaultDescription faultDesc, OperationDescription opDesc) {
+    private FaultBeanDesc create(EndpointDescription ed, 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.
@@ -161,6 +167,9 @@
         }
         String foundClassName = findArtifact(faultBeanClassName);
         if (foundClassName == null) {
+            faultBeanClassName = findArtifact(faultBeanClassName, ed.getAxisService().getClassLoader());
+        }
+        if (foundClassName == null) {
             faultBeanClassName = missingArtifact(faultBeanClassName);
         }
         if (foundClassName != null) {
@@ -176,7 +185,12 @@
         if (faultBeanLocalName == null || faultBeanLocalName.length() == 0) {
             if (faultBeanClassName != null && faultBeanClassName.length() > 0) {
                 try {
-                    Class faultBean = loadClass(faultBeanClassName);
+                    Class faultBean;
+                    try {
+                        faultBean = loadClass(faultBeanClassName, getContextClassLoader());
+                    } catch (ClassNotFoundException e){
+                        faultBean = loadClass(faultBeanClassName, ed.getAxisService().getClassLoader());
+                    }
                     AnnotationDesc aDesc = AnnotationDescImpl.create(faultBean);
                     if (aDesc.hasXmlRootElement()) {
                         faultBeanLocalName = aDesc.getXmlRootElementName();
@@ -199,7 +213,12 @@
         if (faultBeanNamespace == null || faultBeanNamespace.length() == 0) {
             if (faultBeanClassName != null && faultBeanClassName.length() > 0) {
                 try {
-                    Class faultBean = loadClass(faultBeanClassName);
+                    Class faultBean;
+                    try {
+                        faultBean = loadClass(faultBeanClassName, getContextClassLoader());
+                    } catch (ClassNotFoundException e){
+                        faultBean = loadClass(faultBeanClassName, ed.getAxisService().getClassLoader());
+                    }
                     AnnotationDesc aDesc = AnnotationDescImpl.create(faultBean);
                     if (aDesc.hasXmlRootElement()) {
                         faultBeanNamespace = aDesc.getXmlRootElementNamespace();
@@ -291,6 +310,10 @@
     static final String JAXWS_SUBPACKAGE = "jaxws";
 
     private static String findArtifact(String artifactClassName) {
+        return findArtifact(artifactClassName, getContextClassLoader());
+    }
+
+    private static String findArtifact(String artifactClassName, ClassLoader classLoader) {
         String returnArtifactClassName = null;
         if (artifactClassName == null) {
             return returnArtifactClassName;
@@ -298,7 +321,7 @@
 
         // Try to load the class that was passed in
         try {
-            loadClass(artifactClassName);
+            forName(artifactClassName, true, classLoader);
             returnArtifactClassName = artifactClassName;
         }
         catch (ClassNotFoundException e) {
@@ -313,7 +336,7 @@
                 String className = getSimpleClassName(artifactClassName);
                 String alternateWrapperClass = alternatePackage + "." + className;
                 try {
-                    loadClass(alternateWrapperClass);
+                    loadClass(alternateWrapperClass, getContextClassLoader());
                     returnArtifactClassName = alternateWrapperClass;
                 }
                 catch (ClassNotFoundException e) {
@@ -325,9 +348,9 @@
         return returnArtifactClassName;
     }
 
-    private static Class loadClass(String className) throws ClassNotFoundException {
+    private static Class loadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
         // Don't make this public, its a security exposure
-        return forName(className, true, getContextClassLoader());
+        return forName(className, true, classLoader);
     }
 
     /**

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java Wed Apr 16 17:14:31 2008
@@ -159,6 +159,9 @@
         String implClassName = getServiceImplClassName(endpointDesc);
         if (implClassName != null) {
             Class clz = loadClass(implClassName);
+            if(clz == null){
+                clz = loadClass(implClassName, endpointDesc.getAxisService().getClassLoader());
+            }
             if (clz != null) {
                 addXmlSeeAlsoPackages(clz, msrd, set);
             }
@@ -166,7 +169,7 @@
         EndpointInterfaceDescription endpointInterfaceDesc =
                 endpointDesc.getEndpointInterfaceDescription();
         if (endpointInterfaceDesc != null) {
-            getPackagesFromAnnotations(endpointInterfaceDesc, set, msrd);
+            getPackagesFromAnnotations(endpointDesc, endpointInterfaceDesc, set, msrd);
         }
         return set;
     }
@@ -177,6 +180,7 @@
      * @param msrd
      */
     private static void getPackagesFromAnnotations(
+            EndpointDescription ed,
             EndpointInterfaceDescription endpointInterfaceDesc,
             TreeSet<String> set,
             MarshalServiceRuntimeDescription msrd) {
@@ -190,7 +194,7 @@
         // Build a set of packages from all of the operations
         if (opDescs != null) {
             for (int i = 0; i < opDescs.length; i++) {
-                getPackagesFromAnnotations(opDescs[i], set, msrd);
+                getPackagesFromAnnotations(ed, opDescs[i], set, msrd);
             }
         }
         return;
@@ -202,7 +206,7 @@
      * @param opDesc OperationDescription
      * @param set    Set<Package> that is updated
      */
-    private static void getPackagesFromAnnotations(OperationDescription opDesc, TreeSet<String> set,
+    private static void getPackagesFromAnnotations(EndpointDescription ed, OperationDescription opDesc, TreeSet<String> set,
                                                    MarshalServiceRuntimeDescription msrd) {
 
         // Walk the parameter information
@@ -217,7 +221,7 @@
         FaultDescription[] faultDescs = opDesc.getFaultDescriptions();
         if (faultDescs != null) {
             for (int i = 0; i < faultDescs.length; i++) {
-                getPackagesFromAnnotations(faultDescs[i], set, msrd);
+                getPackagesFromAnnotations(ed, faultDescs[i], set, msrd);
             }
         }
 
@@ -277,7 +281,8 @@
      * @param faultDesc FaultDescription
      * @param set       Set<Package> that is updated
      */
-    private static void getPackagesFromAnnotations(FaultDescription faultDesc, TreeSet<String> set,
+    private static void getPackagesFromAnnotations(EndpointDescription ed, 
+                                                   FaultDescription faultDesc, TreeSet<String> set,
                                                    MarshalServiceRuntimeDescription msrd) {
 
         FaultBeanDesc faultBeanDesc = msrd.getFaultBeanDesc(faultDesc);
@@ -297,6 +302,9 @@
             return;
         }
         Class faultBean = loadClass(faultBeanName);
+        if(faultBean == null){
+            faultBean = loadClass(faultBeanName, ed.getAxisService().getClassLoader());
+        }
         if (faultBean != null) {
             setTypeAndElementPackages(faultBean, faultBeanDesc.getFaultBeanNamespace(),
                                       faultBeanDesc.getFaultBeanLocalName(), set, msrd);
@@ -467,6 +475,36 @@
             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.
+        } catch (Throwable e) {
+            // TODO Should the exception be swallowed ?
+            if (log.isDebugEnabled()) {
+                log.debug("PackageSetBuilder cannot load the following class:" + className);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Loads the class
+     *
+     * @param className
+     * @return Class (or null if the class cannot be loaded)
+     */
+    private static Class loadClass(String className, ClassLoader loader) {
+        // Don't make this public, its a security exposure
+        if (className == null || className.length() == 0) {
+            return null;
+        }
+        try {
+            // Class.forName does not support primitives
+            Class cls = ClassUtils.getPrimitiveClass(className);
+            if (cls == null) {
+                cls = Class.forName(className, true, loader);
             }
             return cls;
             //Catch Throwable as ClassLoader can throw an NoClassDefFoundError that

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java Wed Apr 16 17:14:31 2008
@@ -91,7 +91,7 @@
         EndpointInterfaceDescription endpointInterfaceDesc =
                 endpointDesc.getEndpointInterfaceDescription();
         if (endpointInterfaceDesc != null) {
-            getPropertyDescMaps(endpointInterfaceDesc, ap, map);
+            getPropertyDescMaps(endpointDesc, endpointInterfaceDesc, ap, map);
         }
     }
 
@@ -101,7 +101,8 @@
      * @param ap                    ArtifactProcessor which found the artifact classes
      * @param map
      */
-    private static void getPropertyDescMaps(EndpointInterfaceDescription endpointInterfaceDesc,
+    private static void getPropertyDescMaps(EndpointDescription endpointDesc,
+                                            EndpointInterfaceDescription endpointInterfaceDesc,
                                             ArtifactProcessor ap,
                                             Map<Class, Map<String, PropertyDescriptorPlus>> map) {
         OperationDescription[] opDescs = endpointInterfaceDesc.getOperations();
@@ -109,7 +110,7 @@
         // Build a set of packages from all of the opertions
         if (opDescs != null) {
             for (int i = 0; i < opDescs.length; i++) {
-                getPropertyDescMaps(opDescs[i], ap, map);
+                getPropertyDescMaps(endpointDesc, opDescs[i], ap, map);
             }
         }
     }
@@ -119,7 +120,8 @@
      * @param opDesc
      * @param map
      */
-    private static void getPropertyDescMaps(OperationDescription opDesc,
+    private static void getPropertyDescMaps(EndpointDescription endpointDesc,
+                                            OperationDescription opDesc,
                                             ArtifactProcessor ap,
                                             Map<Class, Map<String, PropertyDescriptorPlus>> map) {
 
@@ -127,18 +129,18 @@
         FaultDescription[] faultDescs = opDesc.getFaultDescriptions();
         if (faultDescs != null) {
             for (int i = 0; i < faultDescs.length; i++) {
-                getPropertyDescMaps(faultDescs[i], ap, map);
+                getPropertyDescMaps(endpointDesc, faultDescs[i], ap, map);
             }
         }
 
         // Also consider the request and response wrappers
         String wrapperName = ap.getRequestWrapperMap().get(opDesc);
         if (wrapperName != null) {
-            addPropertyDesc(wrapperName, map);
+            addPropertyDesc(endpointDesc, wrapperName, map);
         }
         wrapperName = ap.getResponseWrapperMap().get(opDesc);
         if (wrapperName != null) {
-            addPropertyDesc(wrapperName, map);
+            addPropertyDesc(endpointDesc, wrapperName, map);
         }
     }
 
@@ -146,7 +148,8 @@
      * @param opDesc
      * @param map
      */
-    private static void getPropertyDescMaps(FaultDescription faultDesc,
+    private static void getPropertyDescMaps(EndpointDescription endpointDesc,
+                                            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.
@@ -173,18 +176,22 @@
             String faultDescBeanName = faultBeanDesc.getFaultBeanClassName();
             Class faultDescBean = loadClass(faultDescBeanName);
             if (faultDescBean != null) {
-                addPropertyDesc(faultDescBeanName, map);
-                addPropertyDesc(faultDescExceptionName, map);
+                addPropertyDesc(endpointDesc, faultDescBeanName, map);
+                addPropertyDesc(endpointDesc, faultDescExceptionName, map);
             }
 
         }
     }
 
-    private static void addPropertyDesc(String clsName,
+    private static void addPropertyDesc(EndpointDescription endpointDesc, 
+                                        String clsName,
                                         Map<Class, Map<String, PropertyDescriptorPlus>> map) {
 
         Class cls = loadClass(clsName);
         if (cls == null) {
+            cls = loadClass(clsName, endpointDesc.getAxisService().getClassLoader());
+        }
+        if (cls == null) {
             return;
         }
 
@@ -214,6 +221,33 @@
 
             return forName(className, true,
                            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.
+        } catch (Throwable e) {
+            // TODO Should the exception be swallowed ?
+            if (log.isDebugEnabled()) {
+                log.debug("PackageSetBuilder cannot load the following class:" + className);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Loads the class
+     *
+     * @param className
+     * @return Class (or null if the class cannot be loaded)
+     */
+    private static Class loadClass(String className, ClassLoader cl) {
+        // Don't make this public, its a security exposure
+        if (className == null || className.length() == 0) {
+            return null;
+        }
+        try {
+
+            return forName(className, true,
+                           cl);
             //Catch Throwable as ClassLoader can throw an NoClassDefFoundError that
             //does not extend Exception, so lets catch everything that extends Throwable
             //rather than just Exception.

Modified: webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageRPCTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageRPCTests.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageRPCTests.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageRPCTests.java Wed Apr 16 17:14:31 2008
@@ -28,6 +28,8 @@
 import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
 import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
 import org.apache.axis2.jaxws.message.factory.MessageFactory;
+import org.apache.axis2.jaxws.message.headers.ConfigBody;
+import org.apache.axis2.jaxws.message.headers.ConfigHeader;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.test.stock1.ObjectFactory;
 import org.test.stock1.StockPrice;
@@ -248,7 +250,6 @@
         assertTrue(newText.contains("Body"));
     }
     
-    
     public void testJAXBInflow_soap11() throws Exception {
 		_testJAXBInflow(sampleEnvelope11);
 	}
@@ -314,4 +315,80 @@
         assertTrue(obj.getPrice().equals("100"));
     }
     
+    public void testJAXBHeader() throws Exception {
+        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+                "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
+                "\t<soapenv:Header>\n" +
+                "\t\t<ns2:ConfigHeader2 xmlns:ns2=\"http://headers.message.jaxws.axis2.apache.org/types4\">\n" +
+                "\t\t\t<message>configHeader2</message>\n" +
+                "\t\t</ns2:ConfigHeader2>\n" +
+                "\t\t<ns2:ConfigHeader3 xmlns:ns2=\"http://headers.message.jaxws.axis2.apache.org/types4\">\n" +
+                "\t\t\t<message>xyz</message>\n" +
+                "\t\t</ns2:ConfigHeader3>\n" +
+                "\t</soapenv:Header>\n" +
+                "\t<soapenv:Body>\n" +
+                "\t\t<rpcOp:ConfigResponse xmlns:rpcOp=\"http://headers.message.jaxws.axis2.apache.org/types4\">\n" +
+                "\t\t<rpcParam:ConfigBody xmlns:rpcParam=\"http://headers.message.jaxws.axis2.apache.org/types4\">\n" +
+                "\t\t\t<message>Got it</message>\n" +
+                "\t\t</rpcParam:ConfigBody>\n" +
+                "\t\t</rpcParam:ConfigResponse>\n" +
+                "\t</soapenv:Body>\n" +
+                "</soapenv:Envelope>";
+
+        // Create a SOAP OM out of the sample incoming XML.  This
+        // simulates what Axis2 will be doing with the inbound message. 
+        StringReader sr = new StringReader(xml);
+        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
+        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
+        OMElement omElement = builder.getSOAPEnvelope();
+        
+        // Create a SOAP 1.1 Message from the sample incoming XML
+        MessageFactory mf = (MessageFactory)
+            FactoryRegistry.getFactory(MessageFactory.class);
+        Message m = mf.createFrom(omElement, null);
+        
+        // Check to see if the message is a fault.  The client/server will always call this method.
+        // The Message must respond appropriately without doing a conversion.
+        boolean isFault = m.isFault();
+        assertTrue(!isFault);
+        assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
+                    "OM".equals(m.getXMLPartContentType()));
+        
+        // Indicate that the message should be accessed as RPC
+        m.setStyle(Style.RPC);
+        
+        // Get the BlockFactory
+        JAXBBlockFactory bf = (JAXBBlockFactory)
+            FactoryRegistry.getFactory(JAXBBlockFactory.class);
+        
+        // Create the JAXBContext instance that will be used
+        // to deserialize the JAX-B object content in the message.
+        JAXBBlockContext context = new JAXBBlockContext(ConfigHeader.class.getPackage().getName());
+        
+        // Check to see if the message is a fault.  The client/server will always call this method.
+        // The Message must respond appropriately without doing a conversion.
+        isFault = m.isFault();
+        assertTrue(!isFault);
+
+        // Get the JAXBBlock that wraps the content
+        Block block = m.getHeaderBlock("http://headers.message.jaxws.axis2.apache.org/types4","ConfigHeader2", context, bf);
+
+        // Get the business object from the block, which should be a 
+        // JAX-B object
+        Object bo = block.getBusinessObject(true);
+        
+        // Check to make sure the right object was returned
+        assertNotNull(bo);
+        if (bo instanceof JAXBElement) {
+            bo = ((JAXBElement) bo).getValue();
+        }
+        assertTrue(bo instanceof ConfigHeader);
+        
+        Block block2 = m.getBodyBlock(context, bf);
+        Object b2 = block2.getBusinessObject(true);
+        if (b2 instanceof JAXBElement) {
+            b2 = ((JAXBElement) b2).getValue();
+        }
+        assertTrue(b2 instanceof ConfigBody);
+    }
 }

Added: webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigBody.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigBody.java?rev=648902&view=auto
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigBody.java (added)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigBody.java Wed Apr 16 17:14:31 2008
@@ -0,0 +1,80 @@
+/*
+ * 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.message.headers;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ConfigBody complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="ConfigBody">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ConfigBody", propOrder = {
+    "message"
+})
+public class ConfigBody {
+
+    @XmlElement(required = true)
+    protected String message;
+
+    /**
+     * Gets the value of the message property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getMessage() {
+        return message;
+    }
+
+    /**
+     * Sets the value of the message property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setMessage(String value) {
+        this.message = value;
+    }
+
+}

Added: webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigHeader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigHeader.java?rev=648902&view=auto
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigHeader.java (added)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigHeader.java Wed Apr 16 17:14:31 2008
@@ -0,0 +1,80 @@
+/*
+ * 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.message.headers;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ConfigHeader complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="ConfigHeader">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ConfigHeader", propOrder = {
+    "message"
+})
+public class ConfigHeader {
+
+    @XmlElement(required = true)
+    protected String message;
+
+    /**
+     * Gets the value of the message property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getMessage() {
+        return message;
+    }
+
+    /**
+     * Sets the value of the message property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setMessage(String value) {
+        this.message = value;
+    }
+
+}

Added: webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ObjectFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ObjectFactory.java?rev=648902&view=auto
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ObjectFactory.java (added)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ObjectFactory.java Wed Apr 16 17:14:31 2008
@@ -0,0 +1,91 @@
+/*
+ * 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.message.headers;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+@XmlRegistry
+public class ObjectFactory {
+
+    private final static QName _ConfigHeader1_QNAME = new QName("http://headers.message.jaxws.axis2.apache.org/types4", "ConfigHeader1");
+    private final static QName _ConfigHeader3_QNAME = new QName("http://headers.message.jaxws.axis2.apache.org/types4", "ConfigHeader3");
+    private final static QName _ConfigHeader2_QNAME = new QName("http://headers.message.jaxws.axis2.apache.org/types4", "ConfigHeader2");
+    private final static QName _ConfigBody_QNAME = new QName("http://headers.message.jaxws.axis2.apache.org/types4", "ConfigBody");
+
+    public ObjectFactory() {
+    }
+
+    /**
+     * Create an instance of {@link ConfigHeader }
+     * 
+     */
+    public ConfigHeader createConfigHeader() {
+        return new ConfigHeader();
+    }
+    
+    /**
+     * Create an instance of {@link ConfigHeader }
+     * 
+     */
+    public ConfigBody createConfigBody() {
+        return new ConfigBody();
+    }
+
+    /**
+     * Create an instance of {@link JAXBElement }{@code <}{@link ConfigBody }{@code >}}
+     * 
+     */
+    @XmlElementDecl(namespace = "http://headers.message.jaxws.axis2.apache.org/types4", name = "ConfigBody")
+    public JAXBElement<ConfigBody> createConfigBody(ConfigBody value) {
+        return new JAXBElement<ConfigBody>(_ConfigBody_QNAME, ConfigBody.class, null, value);
+    }
+    
+    /**
+     * Create an instance of {@link JAXBElement }{@code <}{@link ConfigHeader }{@code >}}
+     * 
+     */
+    @XmlElementDecl(namespace = "http://headers.message.jaxws.axis2.apache.org/types4", name = "ConfigHeader1")
+    public JAXBElement<ConfigHeader> createConfigHeader1(ConfigHeader value) {
+        return new JAXBElement<ConfigHeader>(_ConfigHeader1_QNAME, ConfigHeader.class, null, value);
+    }
+
+    /**
+     * Create an instance of {@link JAXBElement }{@code <}{@link ConfigHeader }{@code >}}
+     * 
+     */
+    @XmlElementDecl(namespace = "http://headers.message.jaxws.axis2.apache.org/types4", name = "ConfigHeader3")
+    public JAXBElement<ConfigHeader> createConfigHeader3(ConfigHeader value) {
+        return new JAXBElement<ConfigHeader>(_ConfigHeader3_QNAME, ConfigHeader.class, null, value);
+    }
+
+    /**
+     * Create an instance of {@link JAXBElement }{@code <}{@link ConfigHeader }{@code >}}
+     * 
+     */
+    @XmlElementDecl(namespace = "http://headers.message.jaxws.axis2.apache.org/types4", name = "ConfigHeader2")
+    public JAXBElement<ConfigHeader> createConfigHeader2(ConfigHeader value) {
+        return new JAXBElement<ConfigHeader>(_ConfigHeader2_QNAME, ConfigHeader.class, null, value);
+    }
+
+}

Added: webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/package-info.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/package-info.java?rev=648902&view=auto
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/package-info.java (added)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/package-info.java Wed Apr 16 17:14:31 2008
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://headers.message.jaxws.axis2.apache.org/types4")
+package org.apache.axis2.jaxws.message.headers;

Modified: webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java (original)
+++ webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java Wed Apr 16 17:14:31 2008
@@ -26,9 +26,11 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.Parameter;
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.transport.http.util.URLTemplatingUtil;
 import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -52,6 +54,15 @@
             log.debug("  isDoingSWA=" + format.isDoingSWA());
         }
         OMElement element = msgCtxt.getEnvelope();
+        
+        int optimizedThreshold = Utils.getMtomThreshold(msgCtxt);       
+        if(optimizedThreshold > 0){
+        	if(log.isDebugEnabled()){
+        		log.debug("Setting MTOM optimized Threshold Value on OMOutputFormat");
+        	}
+        	format.setOptimizedThreshold(optimizedThreshold);
+        }	        
+
         try {
             if (!(format.isOptimized()) & format.isDoingSWA()) {
                 StringWriter bufferedSOAPBody = new StringWriter();

Modified: webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/util/Utils.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/util/Utils.java Wed Apr 16 17:14:31 2008
@@ -540,4 +540,21 @@
             });
         }
     }
+    
+    public static int getMtomThreshold(MessageContext msgCtxt){
+    	Integer value = null;         
+        if(!msgCtxt.isServerSide()){                
+	        value = (Integer)msgCtxt.getProperty(Constants.Configuration.MTOM_THRESHOLD);	        
+        }else{
+        	Parameter param = msgCtxt.getParameter(Constants.Configuration.MTOM_THRESHOLD);
+        	if(param!=null){
+        		value = (Integer)param.getValue();       		        		
+        	}        	        	
+        }
+        int threshold = (value!=null)?value.intValue():0;
+        if(log.isDebugEnabled()){
+        	log.debug("MTOM optimized Threshold value ="+threshold);
+        }
+        return threshold;
+    }
 }

Modified: webservices/axis2/branches/java/1_4/modules/kernel/test/org/apache/axis2/engine/MessageContextChangeTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/kernel/test/org/apache/axis2/engine/MessageContextChangeTest.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/kernel/test/org/apache/axis2/engine/MessageContextChangeTest.java (original)
+++ webservices/axis2/branches/java/1_4/modules/kernel/test/org/apache/axis2/engine/MessageContextChangeTest.java Wed Apr 16 17:14:31 2008
@@ -25,6 +25,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import java.lang.reflect.Field;
+import java.util.Arrays;
 
 public class MessageContextChangeTest extends TestCase {
     protected static final Log log = LogFactory.getLog(MessageContextChangeTest.class);
@@ -109,9 +110,9 @@
             new FieldDescription("boolean", "executedPhasesReset"),
             new FieldDescription("java.lang.String", "selfManagedDataDelimiter"),
             new FieldDescription("java.lang.Class",
-                                 "class$org$apache$axis2$context$MessageContext"),
+                                 new String[] {"class$org$apache$axis2$context$MessageContext","class$0"}),
             new FieldDescription("java.lang.Class",
-                                 "class$org$apache$axis2$context$SelfManagedDataManager"),
+                                 new String[] {"class$org$apache$axis2$context$SelfManagedDataManager","class$1"}),
             new FieldDescription("java.lang.Exception", "failureReason"),
     };
 
@@ -144,19 +145,22 @@
 
         for (int i = 0; i < numberKnownFields; i++) {
             // see if this entry is in the actual list
-            String name = knownList[i].getName();
-
-            Field actualField = findField(fields, name);
+            String[] names = knownList[i].getNames();
+            Field actualField = null;
+            for (int j = 0; actualField == null && j < names.length; j++) {
+                String name = names[j];
+                actualField = findField(fields, name);
+            }
 
             if (actualField == null) {
-                log.error("ERROR:  MessageContext is missing field [" + name + "]");
+                log.error("ERROR:  MessageContext is missing field [" + Arrays.asList(names) + "]");
                 noChange = false;
             } else {
                 String knownType = knownList[i].getType();
                 String actualType = actualField.getType().getName();
 
                 if (!knownType.equals(actualType)) {
-                    log.error("ERROR:  MessageContext field [" + name +
+                    log.error("ERROR:  MessageContext field [" + Arrays.asList(names) +
                             "] expected type [" + knownType + "] does not match actual type [" +
                             actualType + "]");
                     noChange = false;
@@ -212,9 +216,11 @@
 
     private FieldDescription findFieldDescription(String name) {
         for (int k = 0; k < knownList.length; k++) {
-            String fieldName = knownList[k].getName();
-            if (fieldName.equals(name)) {
-                return knownList[k];
+            String[] fieldName = knownList[k].getNames();
+            for (int i = 0; i < fieldName.length; i++) {
+                if (fieldName[i].equals(name)) {
+                    return knownList[k];
+                }
             }
         }
         return null;
@@ -223,7 +229,7 @@
 
     private class FieldDescription {
         String type = null;
-        String name = null;
+        String[] name = null;
 
         // constructor
         public FieldDescription() {
@@ -232,6 +238,12 @@
         // constructor
         public FieldDescription(String t, String n) {
             type = t;
+            name = new String[]{n};
+        }
+
+        // constructor
+        public FieldDescription(String t, String[] n) {
+            type = t;
             name = n;
         }
 
@@ -239,16 +251,12 @@
             return type;
         }
 
-        public String getName() {
+        public String[] getNames() {
             return name;
         }
 
         public void setType(String t) {
             type = t;
-        }
-
-        public void setName(String n) {
-            name = n;
         }
     }
 

Modified: webservices/axis2/branches/java/1_4/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java (original)
+++ webservices/axis2/branches/java/1_4/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java Wed Apr 16 17:14:31 2008
@@ -183,7 +183,7 @@
             String msg =
                     "Error occurred generating WSDL file for Web service implementation class " +
                             "{" + className + "}: {" + t + "}";
-            log.error(msg);
+            log.error(msg, t);
             throw new WebServiceException(msg, t);
         }
     }

Modified: webservices/axis2/branches/java/1_4/modules/mex/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/mex/pom.xml?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/mex/pom.xml (original)
+++ webservices/axis2/branches/java/1_4/modules/mex/pom.xml Wed Apr 16 17:14:31 2008
@@ -87,20 +87,15 @@
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-install-plugin</artifactId>
+                <artifactId>maven-jar-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>install-jar</id>
-                        <phase>verify</phase>
+                    <phase>package</phase>
                         <goals>
-                            <goal>install-file</goal>
+                      <goal>jar</goal>
                         </goals>
                         <configuration>
-                            <file>${basedir}/target/mex-${version}.jar</file>
-                            <groupId>org.apache.axis2</groupId>
-                            <artifactId>mex</artifactId>
-                            <version>${version}</version>
-                            <packaging>jar</packaging>
+                      <classifier>impl</classifier>
                         </configuration>
                     </execution>
                 </executions>

Modified: webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/echo/EchoServicePortImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/echo/EchoServicePortImpl.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/echo/EchoServicePortImpl.java (original)
+++ webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/echo/EchoServicePortImpl.java Wed Apr 16 17:14:31 2008
@@ -19,9 +19,11 @@
 package org.apache.axis2.jaxws.samples.echo;
 
 import javax.jws.WebService;
+import javax.jws.HandlerChain;
 
 
 @WebService(endpointInterface = "org.apache.axis2.jaxws.samples.echo.EchoServicePortType", targetNamespace = "http://org/apache/axis2/jaxws/samples/echo/", serviceName = "EchoService", portName = "EchoServicePort", wsdlLocation = "WEB-INF/wsdl/Echo.wsdl")
+@HandlerChain(file="loghandler.xml")
 public class EchoServicePortImpl {
 
     public EchoStringResponse echoOperation(EchoStringInput parameter) {

Added: webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/handler/LoggingSOAPHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/handler/LoggingSOAPHandler.java?rev=648902&view=auto
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/handler/LoggingSOAPHandler.java (added)
+++ webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/handler/LoggingSOAPHandler.java Wed Apr 16 17:14:31 2008
@@ -0,0 +1,99 @@
+/*
+ * 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.samples.handler;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import java.io.PrintStream;
+import java.util.Map;
+import java.util.Set;
+
+public class LoggingSOAPHandler implements SOAPHandler<SOAPMessageContext> {
+
+    private PrintStream out;
+
+    public LoggingSOAPHandler() {
+        setLogStream(System.out);
+    }
+
+    protected final void setLogStream(PrintStream ps) {
+        out = ps;
+    }
+
+    public void init(Map c) {
+        System.out.println("LoggingHandler : init() Called....");
+    }
+
+    public Set<QName> getHeaders() {
+        return null;
+    }
+
+    public boolean handleMessage(SOAPMessageContext smc) {
+        System.out.println("LoggingHandler : handleMessage Called....");
+        logToSystemOut(smc);
+        return true;
+    }
+
+    public boolean handleFault(SOAPMessageContext smc) {
+        System.out.println("LoggingHandler : handleFault Called....");
+        logToSystemOut(smc);
+        return true;
+    }
+
+    // nothing to clean up
+    public void close(MessageContext messageContext) {
+        System.out.println("LoggingHandler : close() Called....");
+    }
+
+    // nothing to clean up
+    public void destroy() {
+        System.out.println("LoggingHandler : destroy() Called....");
+    }
+
+    /*
+     * Check the MESSAGE_OUTBOUND_PROPERTY in the context
+     * to see if this is an outgoing or incoming message.
+     * Write a brief message to the print stream and
+     * output the message. The writeTo() method can throw
+     * SOAPException or IOException
+     */
+    protected void logToSystemOut(SOAPMessageContext smc) {
+        Boolean outboundProperty = (Boolean)
+                smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+        out.println("===============================================");
+        if (outboundProperty.booleanValue()) {
+            out.println("Outbound message:");
+        } else {
+            out.println("Inbound message:");
+        }
+
+        SOAPMessage message = smc.getMessage();
+        try {
+            message.writeTo(out);
+            out.println();
+        } catch (Exception e) {
+            out.println("Exception in handler: " + e);
+        }
+        out.println("===============================================");
+    }
+}

Added: webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/apache/axis2/jaxws/samples/echo/loghandler.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/apache/axis2/jaxws/samples/echo/loghandler.xml?rev=648902&view=auto
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/apache/axis2/jaxws/samples/echo/loghandler.xml (added)
+++ webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/apache/axis2/jaxws/samples/echo/loghandler.xml Wed Apr 16 17:14:31 2008
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+	<handler-chain>
+         <service-name-pattern xmlns:ns1="http://org/apache/axis2/jaxws/samples/echo/">ns1:*</service-name-pattern>
+         <handler>
+			<handler-class>org.apache.axis2.jaxws.samples.handler.LoggingSOAPHandler</handler-class>
+		</handler>
+	</handler-chain>
+</handler-chains>



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