axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davidills...@apache.org
Subject svn commit: r501978 [9/24] - in /webservices/axis2/branches/java/maven2: ./ etc/ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/ modules/adb-codegen/src/org/apache/axis2/schema/template/ modules/adb-codegen/src/org/apache/axis2/sc...
Date Wed, 31 Jan 2007 20:35:35 GMT
Modified: webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java Wed Jan 31 12:35:21 2007
@@ -33,6 +33,7 @@
 import javax.xml.soap.SOAPPart;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.WebServiceException;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
@@ -40,7 +41,6 @@
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.message.MessageException;
 import org.apache.axis2.jaxws.message.util.SAAJConverter;
 import org.apache.axis2.jaxws.message.util.SOAPElementReader;
 import org.apache.axis2.jaxws.util.SAAJFactory;
@@ -62,7 +62,7 @@
 	 * @see org.apache.axis2.jaxws.message.util.SAAJConverter#toSAAJ(org.apache.axiom.soap.SOAPEnvelope)
 	 */
 	public SOAPEnvelope toSAAJ(org.apache.axiom.soap.SOAPEnvelope omEnvelope)
-			throws MessageException {
+			throws WebServiceException {
 		SOAPEnvelope soapEnvelope = null;
 		try {
 			// Build the default envelope
@@ -91,10 +91,10 @@
 			
 			NameCreator nc = new NameCreator(soapEnvelope);
 			buildSOAPTree(nc, soapEnvelope, null, reader, false);
-		} catch (MessageException e) {
+		} catch (WebServiceException e) {
 			throw e;
 		} catch (SOAPException e) {
-			throw ExceptionFactory.makeMessageException(e);
+			throw ExceptionFactory.makeWebServiceException(e);
 		}
 		return soapEnvelope;
 	}
@@ -103,7 +103,7 @@
 	 * @see org.apache.axis2.jaxws.message.util.SAAJConverter#toOM(javax.xml.soap.SOAPEnvelope)
 	 */
 	public org.apache.axiom.soap.SOAPEnvelope toOM(SOAPEnvelope saajEnvelope)
-			throws MessageException {
+			throws WebServiceException {
 		// Get a XMLStreamReader backed by a SOAPElement tree
 		XMLStreamReader reader = new SOAPElementReader(saajEnvelope);
 		// Get a SOAP OM Builder.  Passing null causes the version to be automatically triggered
@@ -118,7 +118,7 @@
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.message.util.SAAJConverter#toOM(javax.xml.soap.SOAPElement)
 	 */
-	public OMElement toOM(SOAPElement soapElement) throws MessageException {
+	public OMElement toOM(SOAPElement soapElement) throws WebServiceException {
 		// Get a XMLStreamReader backed by a SOAPElement tree
 		XMLStreamReader reader = new SOAPElementReader(soapElement);
 		// Get a OM Builder.  
@@ -131,7 +131,7 @@
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.message.util.SAAJConverter#toSAAJ(org.apache.axiom.om.OMElement, javax.xml.soap.SOAPElement)
 	 */
-	public SOAPElement toSAAJ(OMElement omElement, SOAPElement parent) throws MessageException {
+	public SOAPElement toSAAJ(OMElement omElement, SOAPElement parent) throws WebServiceException {
 		XMLStreamReader reader = null;
 		
 		// If the OM element is not attached to a parser (builder), then the OM
@@ -148,7 +148,7 @@
 			env = env.getParentElement();
 		}
 		if (env == null) {
-			throw ExceptionFactory.makeMessageException(Messages.getMessage("SAAJConverterErr1"));
+			throw ExceptionFactory.makeWebServiceException(Messages.getMessage("SAAJConverterErr1"));
 		}
 		NameCreator nc = new NameCreator((SOAPEnvelope) env);
 		return buildSOAPTree(nc, null, parent, reader, false);
@@ -158,7 +158,7 @@
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.message.util.SAAJConverter#toSAAJ(org.apache.axiom.om.OMElement, javax.xml.soap.SOAPElement, javax.xml.soap.SOAPFactory)
 	 */
-	public SOAPElement toSAAJ(OMElement omElement, SOAPElement parent, SOAPFactory sf) throws MessageException {
+	public SOAPElement toSAAJ(OMElement omElement, SOAPElement parent, SOAPFactory sf) throws WebServiceException {
 		XMLStreamReader reader = null;
 		
 		// If the OM element is not attached to a parser (builder), then the OM
@@ -191,7 +191,7 @@
 					SOAPElement parent, 
 					XMLStreamReader reader, 
 					boolean quitAtBody) 
-		throws MessageException {
+		throws WebServiceException {
 		try {
 			while(reader.hasNext()) {
 				int eventID = reader.next();	
@@ -272,12 +272,12 @@
 					this._unexpectedEvent("EventID " +String.valueOf(eventID));
 				}
 			}	
-		} catch (MessageException e) {
+		} catch (WebServiceException e) {
 			throw e;
 		} catch (XMLStreamException e) {
-			throw ExceptionFactory.makeMessageException(e);
+			throw ExceptionFactory.makeWebServiceException(e);
 		} catch (SOAPException e) {
-			throw ExceptionFactory.makeMessageException(e);
+			throw ExceptionFactory.makeWebServiceException(e);
 		}
 		return root;
 	}
@@ -405,11 +405,11 @@
 		}
 	}
 	
-	private void _unexpectedEvent(String event) throws MessageException {
+	private void _unexpectedEvent(String event) throws WebServiceException {
 		// Review We need NLS for this message, but this code will probably 
 		// be added to JAX-WS.  So for now we there is no NLS.
 		// TODO NLS
-		throw ExceptionFactory.makeMessageException(Messages.getMessage("SAAJConverterErr2", event));
+		throw ExceptionFactory.makeWebServiceException(Messages.getMessage("SAAJConverterErr2", event));
 	}
 	
 	/**
@@ -447,7 +447,7 @@
 		
 	}
 
-    public MessageFactory createMessageFactory(String namespace) throws SOAPException, MessageException {
+    public MessageFactory createMessageFactory(String namespace) throws SOAPException, WebServiceException {
         return SAAJFactory.createMessageFactory(namespace);
     }
 }

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java Wed Jan 31 12:35:21 2007
@@ -25,6 +25,7 @@
 import org.apache.axis2.jaxws.message.databinding.impl.SOAPEnvelopeBlockFactoryImpl;
 import org.apache.axis2.jaxws.message.databinding.impl.SourceBlockFactoryImpl;
 import org.apache.axis2.jaxws.message.databinding.impl.XMLStringBlockFactoryImpl;
+import org.apache.axis2.jaxws.message.factory.ClassFinderFactory;
 import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
 import org.apache.axis2.jaxws.message.factory.MessageFactory;
 import org.apache.axis2.jaxws.message.factory.OMBlockFactory;
@@ -56,6 +57,7 @@
 		table.put(XMLPartFactory.class, new XMLPartFactoryImpl());
 		table.put(SAAJConverterFactory.class, new SAAJConverterFactoryImpl());
 	    table.put(EndpointLifecycleManagerFactory.class, new EndpointLifecycleManagerFactory());
+	    table.put(ClassFinderFactory.class, new ClassFinderFactory());
 	}
 	/**
 	 * FactoryRegistry is currently a static singleton
@@ -70,5 +72,14 @@
 	 */
 	public static Object getFactory(Class intface) {
 		return table.get(intface);
+	}
+	
+	/**
+	 * setFactory
+	 * @param intface
+	 * @param factoryObject
+	 */
+	public static void setFactory(Class intface, Object factoryObject){
+		table.put(intface, factoryObject);
 	}
 }

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java Wed Jan 31 12:35:21 2007
@@ -109,7 +109,10 @@
 		    //TODO: What should be done if the supplied ClassLoader is null?
             Class _class = Class.forName(className, true, cl);
             return _class;
-		} catch(ClassNotFoundException cnf ){
+	        //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 cnf ){
 			throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
                     "EndpointControllerErr4", className));
 		}

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java Wed Jan 31 12:35:21 2007
@@ -55,6 +55,8 @@
      */
     public void receive(org.apache.axis2.context.MessageContext axisRequestMsgCtx) 
         throws AxisFault {
+        AxisFault faultToReturn = null;
+      
     	if (log.isDebugEnabled()) {
             log.debug("new request received");
         }
@@ -110,14 +112,24 @@
                 
                 OperationContext opCtx = axisResponseMsgCtx.getOperationContext();
                 opCtx.addMessageContext(axisResponseMsgCtx);
+                
+                // If this is a fault message, we want to throw it as an
+                // exception so that the transport can do the appropriate things
+                if (responseMsgCtx.getMessage().isFault())
+                {
+                  faultToReturn =  new AxisFault("An error was detected during JAXWS processing", axisResponseMsgCtx); 
+                }
+                else
+                {
                   //This assumes that we are on the ultimate execution thread
                   ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisResponseMsgCtx);
                 
                   //Create the AxisEngine for the reponse and send it.
                   AxisEngine engine = new AxisEngine(axisResponseMsgCtx.getConfigurationContext());
                   engine.send(axisResponseMsgCtx);
-                //This assumes that we are on the ultimate execution thread
-                ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisResponseMsgCtx);
+                  //This assumes that we are on the ultimate execution thread
+                  ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisResponseMsgCtx);
+                }
             }
 
         } catch (Exception e) {
@@ -133,6 +145,11 @@
 
         //This assumes that we are on the ultimate execution thread
         ThreadContextMigratorUtil.performThreadCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
+        
+        if (faultToReturn != null)
+        {
+          throw faultToReturn;
+        }
     }
     
     private boolean isMepInOnly(String mep){

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java Wed Jan 31 12:35:21 2007
@@ -37,6 +37,7 @@
 import org.apache.axis2.jaxws.core.util.MessageContextUtils;
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils;
 import org.apache.axis2.jaxws.message.Block;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.Protocol;
@@ -49,6 +50,7 @@
 import org.apache.axis2.jaxws.message.factory.SourceBlockFactory;
 import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.util.ClassUtils;
 import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004Constants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -143,10 +145,10 @@
             }
             else {
                 // If it is not MESSAGE, then it is PAYLOAD (which is the default); only work with the body 
-            	if(message.getNumBodyBlocks()!=0){
-            		Block block = message.getBodyBlock(0, null, factory);
+                Block block = message.getBodyBlock(0, null, factory);
+                if(block != null){
             		requestParamValue = block.getBusinessObject(true);
-            	}else{
+            	} else {
             		if(log.isDebugEnabled()){
             			log.debug("No body blocks in SOAPMessage, Calling provider method with null input parameters");
             		}
@@ -177,9 +179,13 @@
             	}
             });
         } catch (Exception e) {
-            e.printStackTrace();
-            //throw ExceptionFactory.makeWebServiceException(e);
-            responseParamValue = new XMLFault(XMLFaultCode.RECEIVER, new XMLFaultReason(e.toString()));
+            Throwable t = ClassUtils.getRootCause(e);
+            if (log.isDebugEnabled()) {
+                log.debug("Marshal Throwable =" + e.getClass().getName());
+                log.debug("  rootCause =" + t.getClass().getName());
+                log.debug("  exception=" + t.toString());
+            }
+            responseParamValue =MethodMarshallerUtils.createXMLFaultFromSystemException(t);
         }
 
         // If we have a one-way operation, then we cannot create a MessageContext 

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/JAXBWrapperTool.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/JAXBWrapperTool.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/JAXBWrapperTool.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/JAXBWrapperTool.java Wed Jan 31 12:35:21 2007
@@ -31,7 +31,6 @@
      * unwrap
      * Returns the list of child objects of the jaxb object
      * @param jaxbObject that is the wrapper element (JAXBElement or object with @XMLRootElement)
-     * @param jaxbContext JAXBContext
      * @param childNames list of xml child names as String
      * @return list of Objects in the same order as the element names.  
      */
@@ -45,8 +44,8 @@
      * Note that the jaxbClass must be the class the represents the complexType. (It should never be JAXBElement)
      * 
      * @param jaxbClass 
-     * @param childObjects, component type objects
      * @param childNames list of xml child names as String
+     * @param childObjects, component type objects
      */ 
     public Object wrap(Class jaxbClass, List<String> childNames, Map<String, Object> childObjects) throws JAXBWrapperException;
     

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/impl/JAXBWrapperToolImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/impl/JAXBWrapperToolImpl.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/impl/JAXBWrapperToolImpl.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/impl/JAXBWrapperToolImpl.java Wed Jan 31 12:35:21 2007
@@ -22,6 +22,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.WeakHashMap;
@@ -29,92 +30,142 @@
 import javax.xml.bind.JAXBElement;
 
 import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.message.databinding.JAXBUtils;
 import org.apache.axis2.jaxws.util.XMLRootElementUtil;
 import org.apache.axis2.jaxws.wrapper.JAXBWrapperTool;
+import org.apache.axis2.jaxws.wrapper.PropertyInfo;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
+/**
+ * The JAXBWrapper tool is used to create a JAXB Object from a series of child objects (wrap) or
+ * get the child objects from a JAXB Object (unwrap)
+ */
 public class JAXBWrapperToolImpl implements JAXBWrapperTool {
 
-	/* (non-Javadoc)
-	 * @see org.apache.axis2.jaxws.wrapped.JAXBWrapperTool#unWrap(java.lang.Object, javax.xml.bind.JAXBContext, java.util.ArrayList)
-	 */
-	
-	/*
-	 * create property descriptor using jaxbObject and child Names,
-	 * getReader and read the object, form the object array and return them.
-	 */
+    private static final Log log = LogFactory.getLog(JAXBWrapperTool.class);
 	
-	public Object[] unWrap(Object jaxbObject, 
-			List<String> childNames) throws JAXBWrapperException{
-		try{
-			if(jaxbObject == null){
-				throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr1"));
-			}
-			if(childNames == null){
-				throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr2"));
-			}
-            
-            // Review: I think that we can remove the next statement.  This is an assertion of the tool
-            // Get the object that will have the property descriptors (i.e. the object representing the complexType)
-            Object jaxbComplexTypeObj = (jaxbObject instanceof JAXBElement) ?
-                    ((JAXBElement)jaxbObject).getValue() : // Type object is the value of the JAXBElement
-                        jaxbObject;                        // Or JAXBObject represents both the element and anon complexType
-            
-			ArrayList<Object> objList = new ArrayList<Object>();
-			Map<String , PropertyInfo> pdTable = createPropertyDescriptors(jaxbComplexTypeObj.getClass(), childNames);
-			for(String childName:childNames){
-				PropertyInfo propInfo = pdTable.get(childName);
-				Object object = propInfo.get(jaxbComplexTypeObj);
-				objList.add(object);
-			}
-			Object[] jaxbObjects = objList.toArray();
-			objList = null;
-			return jaxbObjects;
-		}catch(IntrospectionException e){
-			throw new JAXBWrapperException(e);
-		}catch(IllegalAccessException e){
-			throw new JAXBWrapperException(e);
-		}catch(InvocationTargetException e){
-			throw new JAXBWrapperException(e);
-		}catch(NoSuchFieldException e){
-			throw new JAXBWrapperException(e);
-		}
-	}
+	/**
+     * unwrap
+     * Returns the list of child objects of the jaxb object
+     * @param jaxbObject that is the wrapper element (JAXBElement or object with @XMLRootElement)
+     * @param childNames list of xml child names as String
+     * @return list of Objects in the same order as the element names.  
+     */
+    public Object[] unWrap(Object jaxbObject, 
+            List<String> childNames) throws JAXBWrapperException{
+        
+        
+        if(jaxbObject == null){
+            throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr1"));
+        }
+        if(childNames == null){
+            throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr2"));
+        }
+        
+        // Get the object that will have the property descriptors (i.e. the object representing the complexType)
+        Object jaxbComplexTypeObj = (jaxbObject instanceof JAXBElement) ?
+                ((JAXBElement)jaxbObject).getValue() : // Type object is the value of the JAXBElement
+                    jaxbObject;                        // Or JAXBObject represents both the element and anon complexType
+                
+        if (log.isDebugEnabled()) {
+            log.debug("Invoking unWrap() method with jaxb object:" + jaxbComplexTypeObj.getClass().getName());
+            log.debug("The input child xmlnames are: " + toString(childNames));
+        }
+        // Get the PropertyInfo map.
+        // The method makes sure that each child name has a matching jaxb property
+        Map<String , PropertyInfo> piMap = createPropertyInfoMap(jaxbComplexTypeObj.getClass(), childNames);
+                
+        // Get the corresponsing objects from the jaxb bean
+        ArrayList<Object> objList = new ArrayList<Object>();
+        for(String childName:childNames){
+            PropertyInfo propInfo = piMap.get(childName);
+            Object object = null;
+            try {
+                object = propInfo.get(jaxbComplexTypeObj);
+            } catch (Throwable e) {
+                if (log.isDebugEnabled())  {
+                    log.debug("An exception " + e.getClass() + "occurred while trying to call get() on " + propInfo);
+                    log.debug("The corresponding xml child name is: " + childName);
+                }
+                throw new JAXBWrapperException(e);
+            } 
+            objList.add(object);
+        }
+        Object[] jaxbObjects = objList.toArray();
+        objList = null;
+        return jaxbObjects;
+                
+    }
 
-	/* (non-Javadoc)
-	 * @see org.apache.axis2.jaxws.wrapped.JAXBWrapperTool#wrap(java.lang.Class, java.lang.String, java.util.ArrayList, java.util.ArrayList)
-	 */
-	public Object wrap(Class jaxbClass, 
-			List<String> childNames, Map<String, Object> childObjects)
-			throws JAXBWrapperException {
-		
-		try{
-			if(childNames == null|| childObjects == null){
-				throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr3"));
-			}
-			if(childNames.size() != childObjects.size()){
-				throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr4"));
-			}
-			Map<String, PropertyInfo> pdTable = createPropertyDescriptors(jaxbClass, childNames);
-			Object jaxbObject = jaxbClass.newInstance();
-			for(String childName:childNames){
-				PropertyInfo propInfo = pdTable.get(childName);
-				propInfo.set(jaxbObject, childObjects.get(childName));
-			}
-			return jaxbObject;
-		}catch(IntrospectionException e){
-			throw new JAXBWrapperException(e);
-		}catch(InstantiationException e){
-			throw new JAXBWrapperException(e);
-		}catch(IllegalAccessException e){
-			throw new JAXBWrapperException(e);
-		}catch(InvocationTargetException e){
-			throw new JAXBWrapperException(e);
-		}catch(NoSuchFieldException e){
-			throw new JAXBWrapperException(e);
-		}
+    /**
+     * wrap
+     * Creates a jaxb object that is initialized with the child objects.
+     * 
+     * Note that the jaxbClass must be the class the represents the complexType. (It should never be JAXBElement)
+     * 
+     * @param jaxbClass 
+     * @param childNames list of xml child names as String
+     * @param childObjects, component type objects
+     */ 
+    public Object wrap(Class jaxbClass, 
+            List<String> childNames, Map<String, Object> childObjects)
+    throws JAXBWrapperException {
+        
+        
+        if(childNames == null|| childObjects == null){
+            throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr3"));
+        }
+        if(childNames.size() != childObjects.size()){
+            throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr4"));
+        }
+        
+        if (log.isDebugEnabled()) {
+            log.debug("Invoking unwrap() method to create jaxb object:" + jaxbClass.getName());
+            log.debug("The input child xmlnames are: " + toString(childNames));
+        }
+        
+        // Just like unWrap, get the property info map
+        Map<String, PropertyInfo> pdTable = createPropertyInfoMap(jaxbClass, childNames);
+        
+        // The jaxb object always has a default constructor.  Create the object
+        Object jaxbObject = null;
+        try {
+            jaxbObject = jaxbClass.newInstance();
+        } catch (Throwable t) {
+            if (log.isDebugEnabled())  {
+                log.debug("An exception " + t.getClass() + "occurred while trying to create jaxbobject  " + jaxbClass.getName());
+            }
+            throw new JAXBWrapperException(t);
+        }
+        
+        // Now set each object onto the jaxb object
+        for(String childName:childNames){
+            PropertyInfo propInfo = pdTable.get(childName);
+            Object value = childObjects.get(childName);
+            try {
+                propInfo.set(jaxbObject, value);
+            } catch (Throwable t) {
+                
+                if (log.isDebugEnabled())  {
+                    log.debug("An exception " + t.getClass() + "occurred while trying to call set() on  " + propInfo);
+                    log.debug("The corresponding xml child name is: " + childName);
+                    String name = (value == null) ? "<null>" : value.getClass().getName();
+                    log.debug("The corresponding value object is: " + name);
+                }
+                throw new JAXBWrapperException(t);
+            }
+        }
+        
+        // Return the jaxb object 
+        return jaxbObject;
 	}
 	
-	/** creates propertyDescriptor for the childNames using the jaxbClass.  
+	/**
+     * Creates a PropertyInfo map.
+     * The key to the map is the xml string.
+     * The value is a PropertyInfo object...which is used to set and get bean properties 
+     * creates propertyDescriptor for the childNames using the jaxbClass.  
 	 * use Introspector.getBeanInfo().getPropertyDescriptors() to get all the property descriptors. Assert if # of childNames and propertyDescriptor array
 	 * length do not match. if they match then get the xmlElement name from jaxbClass using propertyDescriptor's display name. See if the xmlElementName matches the 
 	 * childName if not use xmlElement annotation name and create PropertyInfo add childName or xmlElement name there, set propertyDescriptor 
@@ -124,36 +175,66 @@
 	 * @return Map<String, PropertyInfo> - map of ChildNames that map to PropertyInfo that hold the propertyName and PropertyDescriptor.
 	 * @throws IntrospectionException, NoSuchFieldException
 	 */
-	private Map<String, PropertyInfo> createPropertyDescriptors(Class jaxbClass, List<String> childNames) throws IntrospectionException, NoSuchFieldException, JAXBWrapperException{
+	private Map<String, PropertyInfo> createPropertyInfoMap(Class jaxbClass, 
+            List<String> xmlChildNames) throws JAXBWrapperException{
 		Map<String, PropertyInfo> map = new WeakHashMap<String, PropertyInfo>();
 		
+		// Get the property descriptor map for this JAXBClass
+        Map<String, PropertyDescriptor>  pdMap = null;
+        try {
+            pdMap = XMLRootElementUtil.createPropertyDescriptorMap(jaxbClass);
+        } catch (Throwable t) {
+            log.debug("Error occurred to build the PropertyDescriptor map");
+            log.debug("  The JAXBClass is:" + jaxbClass.getName());
+            throw new JAXBWrapperException(t);
+        }
+       
 		
-		Map<String, PropertyDescriptor>  pdMap = XMLRootElementUtil.createPropertyDescriptorMap(jaxbClass);
-		Field field[] = jaxbClass.getDeclaredFields();
-        
-        // It is possible the that the number of fields is greater than the number of child elements due
-        // to customizations.
-		if(field.length < childNames.size()){
-			throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr4", jaxbClass.getName()));
-		}
-        
-		
-        // Create property infos for each class name
-        for (int i=0; i<childNames.size(); i++) {
+        // Now create the property info map
+        for (int i=0; i<xmlChildNames.size(); i++) {
             PropertyInfo propInfo= null;
-            String childName = childNames.get(i);
-            PropertyDescriptor pd = pdMap.get(childName);
+            String xmlChildName = xmlChildNames.get(i);
+            PropertyDescriptor pd = pdMap.get(xmlChildName);
             if(pd == null){
-                throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr6", jaxbClass.getName(), childName));
+                // Each xml child name must have a matching property.  
+                if (log.isDebugEnabled()) {
+                    log.debug("Error occurred trying to match an xml name to a child of a jaxb object");
+                    log.debug("  The JAXBClass is:" + jaxbClass.getName());
+                    log.debug("  The child name that we are looking for is:" + xmlChildName);
+                    log.debug("  The JAXBClass has the following child xml names:" + toString(pdMap.keySet()));
+                    log.debug("  Complete list of child names that we are looking for:" + toString(xmlChildNames));
+                }
+                throw new JAXBWrapperException(Messages.getMessage("JAXBWrapperErr6", jaxbClass.getName(), xmlChildName));
             }
             propInfo = new PropertyInfo(pd);
-            map.put(childName, propInfo);
+            map.put(xmlChildName, propInfo);
         }
         
 		
 		return map;
 	}
 	
+    
+    /**
+     * @param collection
+     * @return list of the names in the collection
+     */
+    private String toString(Collection<String> collection) {
+        String text = "[";
+        if (collection == null) {
+            return "[]";
+        }
+        boolean first = true;
+        for (String name:collection) {
+            if (first) {
+                first = false;
+                text += name;
+            } else {
+                text += "," + name;
+            }
+        }
+        return text + "]";
+    }
 	
 	
 }

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/wsdl/FaultsService.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/wsdl/FaultsService.wsdl?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/wsdl/FaultsService.wsdl (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/wsdl/FaultsService.wsdl Wed Jan 31 12:35:21 2007
@@ -11,13 +11,15 @@
     <xsd:schema targetNamespace="http://org/test/polymorphicfaults">
         
       <xsd:element name="SimpleFault" type="xsd:int"/>
-      <xsd:element name="InvalidTickerFault" type="ts:InvalidTickerFaultBean"/>
-      <xsd:complexType name="InvalidTickerFaultBean">
+      <xsd:element name="InvalidTickerFault" type="ts:InvalidTickerFault_ExceptionBean"/>
+      <xsd:complexType name="InvalidTickerFault_ExceptionBean">
         <xsd:sequence>
            <xsd:element name="legacyData1" type="xsd:string" />
            <xsd:element name="legacyData2" type="xsd:int" />
+           <xsd:element name="message" type="xsd:string" />
         </xsd:sequence>
       </xsd:complexType>
+
 
       <xsd:element name="BaseFault" type="ts:BaseFault"/>
       <xsd:complexType name="BaseFault">

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/wsdl/doclitwrap.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/wsdl/doclitwrap.wsdl?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/wsdl/doclitwrap.wsdl (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/wsdl/doclitwrap.wsdl Wed Jan 31 12:35:21 2007
@@ -12,6 +12,7 @@
 			xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
 			<xsd:element name="MyFault" type="xsd:string" />
+			<xsd:element name="headerValue" type="xsd:string" />
 
 			<xsd:element name="oneWayVoid">
 				<xsd:complexType>
@@ -159,6 +160,31 @@
 					</xsd:sequence>
 				</xsd:complexType>
 			</xsd:element>
+			
+			<xsd:element name="echoStringWSGEN1">
+				<xsd:complexType />
+			</xsd:element>
+
+			<xsd:element name="echoStringWSGEN1Response">
+				<xsd:complexType>
+					<xsd:sequence>
+						<xsd:element name="return" type="xsd:string" />
+					</xsd:sequence>
+				</xsd:complexType>
+			</xsd:element>
+			
+			<xsd:element name="echoStringWSGEN2">
+			    <xsd:complexType>
+					<xsd:sequence>
+						<xsd:element name="data" type="xsd:string" />
+					</xsd:sequence>
+				</xsd:complexType>
+			</xsd:element>
+
+			<xsd:element name="echoStringWSGEN2Response">
+				<xsd:complexType />
+			</xsd:element>
+			
 		</xsd:schema>
 	</wsdl:types>
 
@@ -212,6 +238,26 @@
 		<wsdl:part name="payload" element="tns:headerResponse" />
 		<wsdl:part name="header0" element="tns:headerPart0" />
 	</wsdl:message>
+	
+	<wsdl:message name="echoStringWSGEN1Request">
+		<wsdl:part name="bodyPart" element="tns:echoStringWSGEN1" />
+		<wsdl:part name="headerPart" element="tns:headerValue" />
+	</wsdl:message>
+
+	<wsdl:message name="echoStringWSGEN1Response">
+		<wsdl:part name="bodyPart" element="tns:echoStringWSGEN1Response" />
+	</wsdl:message>
+	
+	<wsdl:message name="echoStringWSGEN2Request">
+		<wsdl:part name="bodyPart" element="tns:echoStringWSGEN2" />
+	</wsdl:message>
+
+	<wsdl:message name="echoStringWSGEN2Response">
+		<wsdl:part name="bodyPart" element="tns:echoStringWSGEN2Response" />
+	    <wsdl:part name="headerPart" element="tns:headerValue" />
+	</wsdl:message>
+	
+	
 	<wsdl:portType name="DocLitWrap">
 
 		<wsdl:operation name="oneWayVoid">
@@ -245,6 +291,16 @@
 			<wsdl:input message="tns:finOpRequest" />
 			<wsdl:output message="tns:finOpResponse" />
 		</wsdl:operation>
+		
+		<wsdl:operation name="echoStringWSGEN1">
+			<wsdl:input message="tns:echoStringWSGEN1Request" />
+			<wsdl:output message="tns:echoStringWSGEN1Response" />
+		</wsdl:operation>
+		
+		<wsdl:operation name="echoStringWSGEN2">
+			<wsdl:input message="tns:echoStringWSGEN2Request" />
+			<wsdl:output message="tns:echoStringWSGEN2Response" />
+		</wsdl:operation>
 
 	</wsdl:portType>
 
@@ -255,7 +311,7 @@
 
 		<wsdl:operation name="oneWayVoid">
 			<soap:operation
-				soapAction="http://wrap.sample.test.org/twoWayReturn" />
+				soapAction="http://wrap.sample.test.org/oneWayVoid" />
 			<wsdl:input>
 				<soap:body use="literal" />
 			</wsdl:input>
@@ -263,7 +319,7 @@
 
 		<wsdl:operation name="oneWay">
 			<soap:operation
-				soapAction="http://wrap.sample.test.org/twoWayReturn" />
+				soapAction="http://wrap.sample.test.org/oneWay" />
 			<wsdl:input>
 				<soap:body use="literal" />
 			</wsdl:input>
@@ -271,7 +327,7 @@
 
 		<wsdl:operation name="twoWayHolder">
 			<soap:operation
-				soapAction="http://wrap.sample.test.org/twoWayReturn" />
+				soapAction="http://wrap.sample.test.org/twoWayHolder" />
 			<wsdl:input>
 				<soap:body use="literal" />
 			</wsdl:input>
@@ -330,6 +386,32 @@
 			</wsdl:output>
 
 		</wsdl:operation>
+		
+		<wsdl:operation name="echoStringWSGEN1">
+			<soap:operation
+				soapAction="http://addheaders.sample.test.org/echoStringWSGEN1" />
+        
+			<wsdl:input>
+				<soap:header use="literal" message="tns:echoStringWSGEN1Request" part="headerPart"/>			
+				<soap:body use="literal" message="tns:echoStringWSGEN1Request" part="bodyPart"/>			
+			</wsdl:input>
+			<wsdl:output>
+				<soap:body use="literal" />		
+			</wsdl:output>
+		</wsdl:operation>
+		
+		<wsdl:operation name="echoStringWSGEN2">
+			<soap:operation
+				soapAction="http://addheaders.sample.test.org/echoStringWSGEN2" />
+        
+			<wsdl:input>
+                 <soap:body use="literal" />	
+			</wsdl:input>
+			<wsdl:output>
+			    <soap:header use="literal" message="tns:echoStringWSGEN2Response" part="headerPart"/>			
+				<soap:body use="literal" message="tns:echoStringWSGEN2Response" part="bodyPart"/>			
+			</wsdl:output>
+		</wsdl:operation>
 
 	</wsdl:binding>
 
@@ -341,4 +423,4 @@
 		</wsdl:port>
 	</wsdl:service>
 
-</wsdl:definitions>
+</wsdl:definitions>
\ No newline at end of file

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/xsd/samplemtom.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/xsd/samplemtom.xsd?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/xsd/samplemtom.xsd (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test-resources/xsd/samplemtom.xsd Wed Jan 31 12:35:21 2007
@@ -5,8 +5,11 @@
     xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
     xmlns:tns="urn://mtom.test.org"
     targetNamespace="urn://mtom.test.org">
+    <!-- Use local file for speed -->
+    <!-- <xs:import namespace="http://www.w3.org/2005/05/xmlmime"
+               schemaLocation="http://www.w3.org/2005/05/xmlmime"/>-->
     <xs:import namespace="http://www.w3.org/2005/05/xmlmime"
-               schemaLocation="http://www.w3.org/2005/05/xmlmime"/>
+               schemaLocation="xmlmime.xsd"/>
     <xs:complexType name="ImageDepot">
        <xs:sequence>
            <xs:element name="imageData" 

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/dispatch/JAXBCallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/dispatch/JAXBCallbackHandler.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/dispatch/JAXBCallbackHandler.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/dispatch/JAXBCallbackHandler.java Wed Jan 31 12:35:21 2007
@@ -25,12 +25,17 @@
 
 public class JAXBCallbackHandler<T> implements AsyncHandler<T> {
 
+    T data = null;
     public void handleResponse(Response response) {
         try {
-            EchoStringResponse esr = (EchoStringResponse) response.get();
-            System.out.println(">> Async response received: " + esr.getEchoStringReturn());
+            data = (T) response.get();
+            System.out.println(">> Async response received: " + data);
         } catch (Exception e) {
             e.printStackTrace();
         }
+    }
+    
+    public T getData() {
+        return data;
     }
 }

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/dispatch/JAXBDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/dispatch/JAXBDispatch.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/dispatch/JAXBDispatch.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/dispatch/JAXBDispatch.java Wed Jan 31 12:35:21 2007
@@ -21,9 +21,13 @@
 import java.util.concurrent.Future;
 
 import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
 
+import org.xmlsoap.schemas.soap.envelope.Body;
+import org.xmlsoap.schemas.soap.envelope.Envelope;
+
 import junit.framework.TestCase;
 import test.EchoString;
 import test.EchoStringResponse;
@@ -31,7 +35,9 @@
 
 public class JAXBDispatch extends TestCase {
 
-    private Dispatch<Object> dispatch;
+    private Dispatch<Object> dispatchPayload;
+    private Dispatch<Object> dispatchMessage;
+    private JAXBContext jbc;
     
     public JAXBDispatch(String name) {
         super(name);
@@ -42,25 +48,28 @@
         Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
         svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
         
-        //Create the JAX-B Dispatch object
-        JAXBContext jbc = null;
-        jbc = JAXBContext.newInstance("test");
-        dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+        //Create the JAX-B Dispatch object to recognize the test and soap packages
+        jbc = JAXBContext.newInstance("test:org.xmlsoap.schemas.soap.envelope");
+        
+        // Create Payload and Message Dispatch
+        dispatchPayload = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
                 jbc, Service.Mode.PAYLOAD);
+        dispatchMessage = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                jbc, Service.Mode.MESSAGE);
     }
     
-    public void testSync() throws Exception {
+    public void testSyncPayload() throws Exception {
         System.out.println("---------------------------------------");
         System.out.println("test: " + getName());
 
         // Create the input param
         ObjectFactory factory = new ObjectFactory();
         EchoString request = factory.createEchoString();         
-        request.setInput("SYNC JAXB TEST");
+        request.setInput("SYNC JAXB PAYLOAD TEST");
         
         // Invoke the Dispatch<Object>
         System.out.println(">> Invoking sync Dispatch with JAX-B Parameter");
-        EchoStringResponse response = (EchoStringResponse) dispatch.invoke(request);
+        EchoStringResponse response = (EchoStringResponse) dispatchPayload.invoke(request);
         
         assertNotNull(response);
         
@@ -71,39 +80,148 @@
         assertTrue("[ERROR] - Zero length content in response", response.getEchoStringReturn().length() > 0);
     }
     
-    public void testAysnc() throws Exception {
+    public void testAysncPayload() throws Exception {
         System.out.println("---------------------------------------");
         System.out.println("test: " + getName());
         
         // Create the input param
         ObjectFactory factory = new ObjectFactory();
         EchoString request = factory.createEchoString();         
-        request.setInput("ASYNC(CALLBACK) JAXB TEST");
+        request.setInput("ASYNC(CALLBACK) JAXB PAYLOAD TEST");
         
         // Create the callback for async responses
         JAXBCallbackHandler<Object> callback = new JAXBCallbackHandler<Object>();
         
         // Invoke the Dispatch<Object> asynchronously
         System.out.println(">> Invoking async(callback) Dispatch with JAX-B Parameter");
-        Future<?> monitor = dispatch.invokeAsync(request, callback);
+        Future<?> monitor = dispatchPayload.invokeAsync(request, callback);
         
         while (!monitor.isDone()) {
              System.out.println(">> Async invocation still not complete");
              Thread.sleep(1000);
         }
+        
+        EchoStringResponse response = (EchoStringResponse) callback.getData();
+        assertNotNull(response);
+        
+        System.out.println(">> Response content: " + response.getEchoStringReturn());
+        
+        assertTrue("[ERROR] - Response object was null", response != null);
+        assertTrue("[ERROR] - No content in response object", response.getEchoStringReturn() != null);
+        assertTrue("[ERROR] - Zero length content in response", response.getEchoStringReturn().length() > 0);
+
     }
     
-    public void testOneWay() throws Exception {
+    public void testOneWayPayload() throws Exception {
         System.out.println("---------------------------------------");
         System.out.println("test: " + getName());
 
         // Create the input param
         ObjectFactory factory = new ObjectFactory();
         EchoString request = factory.createEchoString();         
-        request.setInput("ONE-WAY JAXB TEST");
+        request.setInput("ONE-WAY JAXB PAYLOAD TEST");
+        
+        // Invoke the Dispatch<Object> one-way
+        System.out.println(">> Invoking one-way Dispatch with JAX-B Parameter");
+        dispatchPayload.invokeOneWay(request);
+    }
+    
+    public void testSyncMessage() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+
+        // Create the input param
+        ObjectFactory factory = new ObjectFactory();
+        EchoString echoString = factory.createEchoString();         
+        echoString.setInput("SYNC JAXB MESSAGETEST");
+        
+        JAXBElement<Envelope> request = createJAXBEnvelope();
+        request.getValue().getBody().getAny().add(echoString);
+        
+        jbc.createMarshaller().marshal(request,System.out);
+        
+        // Invoke the Dispatch<Object>
+        System.out.println(">> Invoking sync Dispatch with JAX-B Parameter");
+        JAXBElement<Envelope> jaxbResponse = (JAXBElement<Envelope>) dispatchMessage.invoke(request);
+        
+        assertNotNull(jaxbResponse);
+        Envelope response = jaxbResponse.getValue();
+        assertNotNull(response);
+        assertNotNull(response.getBody());
+        EchoStringResponse echoStringResponse = (EchoStringResponse) response.getBody().getAny().get(0);
+        
+        System.out.println(">> Response content: " + echoStringResponse.getEchoStringReturn());
+        assertTrue("[ERROR] - No content in response object", echoStringResponse.getEchoStringReturn() != null);
+        assertTrue("[ERROR] - Zero length content in response", echoStringResponse.getEchoStringReturn().length() > 0);
+    }
+    
+    public void testAysncMessage() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Create the input param
+        ObjectFactory factory = new ObjectFactory();
+        EchoString echoString = factory.createEchoString();         
+        echoString.setInput("ASYNC(CALLBACK) JAXB MESSAGE TEST");
+        
+        JAXBElement<Envelope> request = createJAXBEnvelope();
+        request.getValue().getBody().getAny().add(echoString);
+        
+        
+        // Create the callback for async responses
+        JAXBCallbackHandler<Object> callback = new JAXBCallbackHandler<Object>();
+        
+        // Invoke the Dispatch<Object> asynchronously
+        System.out.println(">> Invoking async(callback) Dispatch with JAX-B Parameter");
+        Future<?> monitor = dispatchMessage.invokeAsync(request, callback);
+        
+        while (!monitor.isDone()) {
+             System.out.println(">> Async invocation still not complete");
+             Thread.sleep(1000);
+        }
+        
+        JAXBElement<Envelope> jaxbResponse = (JAXBElement<Envelope>) callback.getData();
+        
+        assertNotNull(jaxbResponse);
+        Envelope response = jaxbResponse.getValue();
+        
+        assertNotNull(response);
+        assertNotNull(response.getBody());
+        EchoStringResponse echoStringResponse = (EchoStringResponse) response.getBody().getAny().get(0);
+        
+        System.out.println(">> Response content: " + echoStringResponse.getEchoStringReturn());
+        assertTrue("[ERROR] - No content in response object", echoStringResponse.getEchoStringReturn() != null);
+        assertTrue("[ERROR] - Zero length content in response", echoStringResponse.getEchoStringReturn().length() > 0);
+
+        
+    }
+    
+    public void testOneWayMessge() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+
+        // Create the input param
+        ObjectFactory factory = new ObjectFactory();
+        EchoString echoString = factory.createEchoString();         
+        echoString.setInput("ONE-WAY JAXB MESSAGE TEST");
+        
+        JAXBElement<Envelope> request = createJAXBEnvelope();
+        request.getValue().getBody().getAny().add(echoString);
         
         // Invoke the Dispatch<Object> one-way
         System.out.println(">> Invoking one-way Dispatch with JAX-B Parameter");
-        dispatch.invokeOneWay(request);
+        dispatchMessage.invokeOneWay(request);
+    }
+    
+    private JAXBElement<Envelope> createJAXBEnvelope() {
+        org.xmlsoap.schemas.soap.envelope.ObjectFactory factory = 
+            new org.xmlsoap.schemas.soap.envelope.ObjectFactory();
+        Envelope env = new Envelope();
+        
+        Body body = new Body();
+        env.setBody(body);
+        
+        JAXBElement<Envelope> jaxbEnv = factory.createEnvelope(env);
+        return jaxbEnv;
     }
 }

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Wed Jan 31 12:35:21 2007
@@ -68,14 +68,16 @@
 import org.apache.axis2.jaxws.sample.MtomSampleTests;
 import org.apache.axis2.jaxws.sample.NonWrapTests;
 import org.apache.axis2.jaxws.sample.ParallelAsyncTests;
+import org.apache.axis2.jaxws.sample.WSGenTests;
 import org.apache.axis2.jaxws.sample.WrapTests;
 import org.apache.axis2.jaxws.security.BasicAuthSecurityTests;
+import org.apache.log4j.BasicConfigurator;
 
 public class JAXWSTest extends TestCase {
     
     static {
-        // Uncomment the followign line to enable debug
-//        BasicConfigurator.configure();
+        // Uncomment the following line to enable debug
+        // BasicConfigurator.configure();
     }
     
     /**
@@ -130,6 +132,7 @@
         suite.addTestSuite(MtomSampleTests.class);
         suite.addTestSuite(BareTests.class);
         suite.addTestSuite(NonWrapTests.class);
+        suite.addTestSuite(WSGenTests.class);
         suite.addTestSuite(WrapTests.class);
         suite.addTestSuite(NonAnonymousComplexTypeTests.class);
         suite.addTestSuite(AddNumbersTests.class);

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java Wed Jan 31 12:35:21 2007
@@ -259,8 +259,11 @@
      * Create a Block representing an empty XMLString and simulate a 
      * normal Dispatch<String> flow with an application handler.
      * @throws Exception
+     * 
+     * DISABLED THIS TEST. THE TEST IS NOT VALID BECAUSE AN ATTEMPT WAS 
+     * MADE TO ADD A BLOCK THAT IS NOT AN ELEMENT.
      */
-    public void testStringOutflowEmptyString() throws Exception {
+    public void _testStringOutflowEmptyString() throws Exception {
         
         // Create a SOAP 1.1 Message
         MessageFactory mf = (MessageFactory)

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java Wed Jan 31 12:35:21 2007
@@ -1,7 +1,10 @@
 package org.apache.axis2.jaxws.polymorphic.shape.tests;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.net.MalformedURLException;
+import java.net.ConnectException;
+import java.net.UnknownHostException;
 import java.net.URL;
 import java.util.Iterator;
 import java.util.Set;
@@ -80,6 +83,15 @@
 		} catch (MalformedURLException e) {
 			e.printStackTrace();
 			fail();
+		}catch(FileNotFoundException e) {
+			e.printStackTrace();
+			fail();
+		}catch(UnknownHostException e) {
+			e.printStackTrace();
+			fail();
+		}catch(ConnectException e) {
+			e.printStackTrace();
+			fail();
 		}catch(WSDLException e){
 			e.printStackTrace();
 			fail();
@@ -114,6 +126,15 @@
 			}
 			System.out.println("------------------------------");
 		} catch (MalformedURLException e) {
+			e.printStackTrace();
+			fail();
+		}catch(FileNotFoundException e) {
+			e.printStackTrace();
+			fail();
+		}catch(UnknownHostException e) {
+			e.printStackTrace();
+			fail();
+		}catch(ConnectException e) {
 			e.printStackTrace();
 			fail();
 		}catch(WSDLException e){

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java Wed Jan 31 12:35:21 2007
@@ -22,15 +22,19 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.DetailEntry;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.Node;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.Binding;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
 import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.axis2.jaxws.provider.soapmsg.SoapMessageProvider;
 
@@ -53,6 +57,9 @@
     private String XML_INVOKE = "<ns2:invoke xmlns:ns2=\"http://org.test.soapmessage\"><invoke_str>" + 
         SoapMessageProvider.XML_REQUEST +
         "</invoke_str></ns2:invoke>";
+    private String EMPTYBODY_INVOKE = "<ns2:invoke xmlns:ns2=\"http://org.test.soapmessage\"><invoke_str>" + 
+        SoapMessageProvider.XML_EMPTYBODY_REQUEST +
+        "</invoke_str></ns2:invoke>";
     private String ATTACHMENT_INVOKE = "<ns2:invoke xmlns:ns2=\"http://org.test.soapmessage\"><invoke_str>" + 
         SoapMessageProvider.XML_ATTACHMENT_REQUEST +
         "</invoke_str></ns2:invoke>";
@@ -69,6 +76,9 @@
     private String XML_FAULT_INVOKE = "<ns2:invoke xmlns:ns2=\"http://org.test.soapmessage\"><invoke_str>" + 
     SoapMessageProvider.XML_FAULT_REQUEST +
     "</invoke_str></ns2:invoke>";
+    private String XML_WSE_INVOKE = "<ns2:invoke xmlns:ns2=\"http://org.test.soapmessage\"><invoke_str>" + 
+    SoapMessageProvider.XML_WSE_REQUEST +
+    "</invoke_str></ns2:invoke>";
                 
     
     protected void setUp() throws Exception {
@@ -126,11 +136,51 @@
     }
     
     /**
+     * Sends an SOAPMessage containing only xml data to the web service.  
+     * Receives a response containing an empty body
+     */
+    public void testProviderSourceXMLEmptyBody(){
+        try{       
+            // Create the dispatch
+            Dispatch<SOAPMessage> dispatch = createDispatch();
+            
+            // Create the SOAPMessage
+            String msg = reqMsgStart + EMPTYBODY_INVOKE + reqMsgEnd;
+            MessageFactory factory = MessageFactory.newInstance();
+            SOAPMessage request = factory.createMessage(null, 
+                    new ByteArrayInputStream(msg.getBytes()));
+            
+            // Test the transport headers by sending a content description
+            request.setContentDescription(SoapMessageProvider.XML_EMPTYBODY_REQUEST);
+            
+            // Dispatch
+            System.out.println(">> Invoking SourceMessageProviderDispatch");
+            SOAPMessage response = dispatch.invoke(request);
+            
+            // Check assertions
+            assertTrue(response !=null);
+            assertTrue(response.getSOAPBody() != null);
+            assertTrue(response.getSOAPBody().getFirstChild() == null);  // There should be nothing in the body
+            
+            assertTrue(countAttachments(response) == 0);
+            
+            // Print out the response
+            System.out.println(">> Response [" + response.toString() + "]");
+            response.writeTo(System.out);
+            
+        }catch(Exception e){
+            e.printStackTrace();
+            fail("Caught exception " + e);
+        }
+        
+    }
+    
+    /**
      * Sends an SOAPMessage containing only xml data 
      * Provider will throw a Fault
      */
-    public void testProviderSOAPFault(){
-        try{       
+    public void testProviderSOAPFault() throws Exception {
+             
             // Create the dispatch
             Dispatch<SOAPMessage> dispatch = createDispatch();
             
@@ -148,17 +198,49 @@
                 System.out.println(">> Invoking SourceMessageProviderDispatch");
                 SOAPMessage response = dispatch.invoke(request);
                 assertTrue("Expected failure", false);
-            } catch (Exception e) {
-                
-            }
-
-           
+            } catch (SOAPFaultException e) {
+                // Okay
+                SOAPFault fault = e.getFault();
+                assertTrue(fault != null);
+                assertTrue(fault.getFaultString().equals("sample fault"));
+                assertTrue(fault.getDetail() != null);
+                DetailEntry de = (DetailEntry) fault.getDetail().getDetailEntries().next();
+                assertTrue(de != null);
+                assertTrue(de.getLocalName().equals("detailEntry"));
+                assertTrue(de.getValue().equals("sample detail"));
+                assertTrue(fault.getFaultActor().equals("sample actor"));
+            }    
+    }
+    
+    /**
+     * Sends an SOAPMessage containing only xml data 
+     * Provider will throw a generic WebServicesException
+     */
+    public void testProviderWebServiceException() throws Exception {
+             
+            // Create the dispatch
+            Dispatch<SOAPMessage> dispatch = createDispatch();
             
-        }catch(Exception e){
-            e.printStackTrace();
-            fail("Caught exception " + e);
-        }
-        
+            // Create the SOAPMessage
+            String msg = reqMsgStart + XML_WSE_INVOKE + reqMsgEnd;
+            MessageFactory factory = MessageFactory.newInstance();
+            SOAPMessage request = factory.createMessage(null, 
+                    new ByteArrayInputStream(msg.getBytes()));
+            
+            // Test the transport headers by sending a content description
+            request.setContentDescription(SoapMessageProvider.XML_WSE_REQUEST);
+            
+            try {
+                // Dispatch
+                System.out.println(">> Invoking SourceMessageProviderDispatch");
+                SOAPMessage response = dispatch.invoke(request);
+                assertTrue("Expected failure", false);
+            } catch (SOAPFaultException e) {
+                // Okay...SOAPFaultException should be thrown
+                SOAPFault fault = e.getFault();
+                assertTrue(fault != null);
+                assertTrue(fault.getFaultString().equals("A WSE was thrown"));
+            }    
     }
     
     /**
@@ -201,9 +283,10 @@
             AttachmentPart attachmentPart = (AttachmentPart) response.getAttachments().next();
             
             // Check the attachment
-            String content = (String) attachmentPart.getContent();
+            StreamSource contentSS = (StreamSource) attachmentPart.getContent();
+            String content = SoapMessageProvider.getAsString(contentSS);
             assertTrue(content != null);
-            assertTrue(SoapMessageProvider.TEXT_XML_ATTACHMENT.equals(content));
+            assertTrue(content.contains(SoapMessageProvider.TEXT_XML_ATTACHMENT));
             
             // Print out the response
             System.out.println(">> Response [" + response.toString() + "]");
@@ -257,9 +340,10 @@
             AttachmentPart attachmentPart = (AttachmentPart) response.getAttachments().next();
             
             // Check the attachment
-            String content = (String) attachmentPart.getContent();
+            StreamSource contentSS = (StreamSource) attachmentPart.getContent();
+            String content = SoapMessageProvider.getAsString(contentSS);
             assertTrue(content != null);
-            assertTrue(SoapMessageProvider.TEXT_XML_ATTACHMENT.equals(content));
+            assertTrue(content.contains(SoapMessageProvider.TEXT_XML_ATTACHMENT));
             
             // Print out the response
             System.out.println(">> Response [" + response.toString() + "]");
@@ -307,9 +391,11 @@
             AttachmentPart attachmentPart = (AttachmentPart) response.getAttachments().next();
             
             // Check the attachment
-            String content = (String) attachmentPart.getContent();
+            StreamSource contentSS = (StreamSource) attachmentPart.getContent();
+            String content = SoapMessageProvider.getAsString(contentSS);
             assertTrue(content != null);
-            assertTrue(SoapMessageProvider.TEXT_XML_ATTACHMENT.equals(content));
+            assertTrue(content.contains(SoapMessageProvider.TEXT_XML_ATTACHMENT));
+            assert(attachmentPart.getContentId().equals(SoapMessageProvider.ID));
             
             // Print out the response
             System.out.println(">> Response [" + response.toString() + "]");

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsg/SoapMessageProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsg/SoapMessageProvider.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsg/SoapMessageProvider.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsg/SoapMessageProvider.java Wed Jan 31 12:35:21 2007
@@ -17,6 +17,8 @@
 package org.apache.axis2.jaxws.provider.soapmsg;
 
 import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
 import java.util.Iterator;
 
 import javax.xml.soap.AttachmentPart;
@@ -29,10 +31,17 @@
 import javax.xml.soap.SOAPFactory;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.BindingType;
 import javax.xml.ws.Provider;
 import javax.xml.ws.Service;
 import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.WebServiceProvider;
 import javax.xml.ws.soap.SOAPBinding;
 import javax.xml.ws.soap.SOAPFaultException;
@@ -54,6 +63,7 @@
     
     public static String XML_REQUEST              = "xml request";
     public static String XML_RESPONSE             = "xml response";
+    public static String XML_EMPTYBODY_REQUEST    = "xml empty body request";
     public static String XML_ATTACHMENT_REQUEST   = "xml and attachment request";
     public static String XML_ATTACHMENT_RESPONSE  = "xml and attachment response";
     public static String XML_MTOM_REQUEST         = "xml and mtom request";
@@ -61,6 +71,7 @@
     public static String XML_SWAREF_REQUEST       = "xml and swaref request";
     public static String XML_SWAREF_RESPONSE      = "xml and swaref response";
     public static String XML_FAULT_REQUEST        = "xml fault";
+    public static String XML_WSE_REQUEST        = "xml wse fault";
     
     private String XML_RETURN = "<ns2:ReturnType xmlns:ns2=\"http://test\"><return_str>" + 
         SoapMessageProvider.XML_RESPONSE +
@@ -110,6 +121,8 @@
             String text = discElement.getValue();
             if (XML_REQUEST.equals(text)) {
                 response = getXMLResponse(soapMessage, discElement);
+            } else if (XML_EMPTYBODY_REQUEST.equals(text)) {
+                response = getXMLEmptyBodyResponse(soapMessage, discElement);
             } else if (XML_ATTACHMENT_REQUEST.equals(text)) {
                 response = getXMLAttachmentResponse(soapMessage, discElement);
             } else if (XML_MTOM_REQUEST.equals(text)) {
@@ -118,6 +131,8 @@
                 response = getXMLSWARefResponse(soapMessage, discElement);
             } else if (XML_FAULT_REQUEST.equals(text)) {
                 throwSOAPFaultException();
+            } else if (XML_WSE_REQUEST.equals(text)) {
+                throwWebServiceException();
             } else {
                 // We should not get here
                 System.out.println("Unknown Type of Message");
@@ -129,8 +144,8 @@
             //response.writeTo(System.out);
             //System.out.println("\n");
             return response;
-    	} catch (SOAPFaultException sfe) {
-    	    throw sfe;
+    	} catch (WebServiceException wse) {
+    	    throw wse;
         } catch(Exception e){
             System.out.println("***ERROR: In SoapMessageProvider.invoke: Caught exception " + e);
     		e.printStackTrace();
@@ -191,6 +206,26 @@
     }
     
     /**
+     * Get the response for an XML only request
+     * @param request
+     * @param dataElement
+     * @return SOAPMessage
+     */
+    private SOAPMessage getXMLEmptyBodyResponse(SOAPMessage request, SOAPElement dataElement) throws Exception {
+        SOAPMessage response;
+       
+
+        // Additional assertion checks
+        assert(countAttachments(request) == 0);
+        
+        // Build the Response
+        MessageFactory factory = MessageFactory.newInstance();
+        response = factory.createMessage();
+     
+        return response;
+    }
+    
+    /**
      * Get the response for an XML and an Attachment request
      * @param request
      * @param dataElement
@@ -202,8 +237,9 @@
         // Additional assertion checks
         assert(countAttachments(request) == 1);
         AttachmentPart requestAP = (AttachmentPart) request.getAttachments().next();
-        String content = (String) requestAP.getContent();
-        assert(SoapMessageProvider.TEXT_XML_ATTACHMENT.equals(content));
+        StreamSource contentSS = (StreamSource) requestAP.getContent();
+        String content = getAsString(contentSS);
+        assert(content.contains(SoapMessageProvider.TEXT_XML_ATTACHMENT));
         
         // Build the Response
         MessageFactory factory = MessageFactory.newInstance();
@@ -231,8 +267,9 @@
         // Additional assertion checks
         assert(countAttachments(request) == 1);
         AttachmentPart requestAP = (AttachmentPart) request.getAttachments().next();
-        String content = (String) requestAP.getContent();
-        assert(SoapMessageProvider.TEXT_XML_ATTACHMENT.equals(content));
+        StreamSource contentSS = (StreamSource) requestAP.getContent();
+        String content = getAsString(contentSS);
+        assert(content.contains(SoapMessageProvider.TEXT_XML_ATTACHMENT));
         
         System.out.println("The MTOM Request Message appears correct.");
         
@@ -262,8 +299,10 @@
         // Additional assertion checks
         assert(countAttachments(request) == 1);
         AttachmentPart requestAP = (AttachmentPart) request.getAttachments().next();
-        String content = (String) requestAP.getContent();
-        assert(SoapMessageProvider.TEXT_XML_ATTACHMENT.equals(content));
+        assert(requestAP.getContentId().equals(ID));
+        StreamSource contentSS = (StreamSource) requestAP.getContent();
+        String content = getAsString(contentSS);
+        assert(content.contains(SoapMessageProvider.TEXT_XML_ATTACHMENT));
         
         // Build the Response
         MessageFactory factory = MessageFactory.newInstance();
@@ -291,6 +330,7 @@
             Name deName = sf.createName("detailEntry");
             SOAPElement detailEntry = detail.addDetailEntry(deName);
             detailEntry.addTextNode("sample detail");
+            fault.setFaultActor("sample actor");
             
             SOAPFaultException sfe = new SOAPFaultException(fault);
             throw sfe;
@@ -300,6 +340,10 @@
             throw new RuntimeException(e);
         }
     }
+    
+    private void throwWebServiceException() throws WebServiceException {
+        throw new WebServiceException("A WSE was thrown");
+    }
     /**
      * Count Attachments
      * @param msg
@@ -314,5 +358,15 @@
             count++;
         }
         return count;
+    }
+    
+    public static String getAsString(StreamSource ss) throws Exception {
+        
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        Result result = new StreamResult(out);
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        transformer.transform(ss, result); 
+        String text = new String(out.toByteArray());
+        return text;
     }
 }

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultsServiceTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultsServiceTests.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultsServiceTests.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultsServiceTests.java Wed Jan 31 12:35:21 2007
@@ -4,6 +4,7 @@
 package org.apache.axis2.jaxws.sample;
 
 import javax.xml.namespace.QName;
+import javax.xml.soap.DetailEntry;
 import javax.xml.soap.SOAPFault;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.soap.SOAPFaultException;
@@ -171,7 +172,7 @@
      * Test throwing legacy fault
      * Disabled while I fix this test
      */
-    public void _testFaultsService5(){
+    public void testFaultsService5(){
         Exception exception = null;
         try{
             FaultsServicePortType proxy = getProxy();
@@ -284,11 +285,17 @@
         SOAPFaultException sfe = (SOAPFaultException) exception;
         SOAPFault soapFault = sfe.getFault();
         assertTrue(soapFault != null);
-        assertTrue(soapFault.getFaultString().equals("hello world"));
+        assertTrue(soapFault.getFaultString().equals("hello world2"));
         QName faultCode = soapFault.getFaultCodeAsQName();
         assertTrue(faultCode.getNamespaceURI().equals("urn://sample"));
-        assertTrue(faultCode.getLocalPart().equals("faultCode"));
-        assertTrue(soapFault.getFaultActor().equals("actor"));
+        assertTrue(faultCode.getLocalPart().equals("faultCode2"));
+        assertTrue(soapFault.getFaultActor().equals("actor2"));
+        assertTrue(soapFault.getDetail() != null);
+        DetailEntry de = (DetailEntry) soapFault.getDetail().getDetailEntries().next();
+        assertTrue(de != null);
+        assertTrue(de.getNamespaceURI().equals("urn://sample"));
+        assertTrue(de.getLocalName().equals("detailEntry"));
+        assertTrue(de.getValue().equals("Texas"));
     }
     
     /**
@@ -315,6 +322,60 @@
         SOAPFaultException sfe = (SOAPFaultException) exception;
         SOAPFault soapFault = sfe.getFault();
         assertTrue(soapFault != null);
-        assertTrue(soapFault.getFaultString().contains("NullPointerException"));
+        assertTrue(soapFault.getFaultString().equals("java.lang.NullPointerException"));
+    }
+    
+    /**
+     * Tests that that SOAPFaultException (NPE) is thrown 
+     */
+    public void testFaultsService10a(){
+        Exception exception = null;
+        try{
+            FaultsServicePortType proxy = getProxy();
+            
+            // the invoke will throw an exception, if the test is performed right
+            int total = proxy.throwFault(2, "NPE2", 2);  // "NPE" will cause service to throw NPE System Exception
+            
+        }catch(SOAPFaultException e){
+            // Okay
+            exception = e;
+        } catch (Exception e) {
+            fail("Did not get a SOAPFaultException");
+        }
+        
+        System.out.println("----------------------------------");
+        
+        assertNotNull(exception);
+        SOAPFaultException sfe = (SOAPFaultException) exception;
+        SOAPFault soapFault = sfe.getFault();
+        assertTrue(soapFault != null);
+        assertTrue(soapFault.getFaultString().equals("Null Pointer Exception occurred"));
+    }
+    
+    /**
+     * Tests that that SOAPFaultException (for WebServiceException) is thrown 
+     */
+    public void testFaultsService11(){
+        Exception exception = null;
+        try{
+            FaultsServicePortType proxy = getProxy();
+            
+            // the invoke will throw an exception, if the test is performed right
+            int total = proxy.throwFault(2, "WSE", 2);  // "WSE" will cause service to throw WebServiceException System Exception
+            
+        }catch(SOAPFaultException e){
+            // Okay...on the client a SOAPFaultException should be thrown
+            exception = e;
+        } catch (Exception e) {
+            fail("Did not get a SOAPFaultException");
+        }
+        
+        System.out.println("----------------------------------");
+        
+        assertNotNull(exception);
+        SOAPFaultException sfe = (SOAPFaultException) exception;
+        SOAPFault soapFault = sfe.getFault();
+        assertTrue(soapFault != null);
+        assertTrue(soapFault.getFaultString().equals("This is a WebServiceException"));
     }
 }

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java Wed Jan 31 12:35:21 2007
@@ -32,7 +32,10 @@
 			
 		}catch(FaultyWebServiceFault_Exception e){
 			exception = e;
-		}
+		}catch(Exception e) {
+           e.printStackTrace();
+           fail(e.toString());
+        }
 		
 		System.out.println("----------------------------------");
 		

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java Wed Jan 31 12:35:21 2007
@@ -12,6 +12,7 @@
 import junit.framework.TestSuite;
 import org.apache.axis2.jaxws.sample.parallelasync.server.AsyncPort;
 import org.apache.axis2.jaxws.sample.parallelasync.server.AsyncService;
+import org.apache.log4j.BasicConfigurator;
 import org.test.parallelasync.CustomAsyncResponse;
 import org.test.parallelasync.SleepResponse;
 
@@ -26,6 +27,7 @@
     private static final String DOCLITWR_ASYNC_ENDPOINT =
         "http://localhost:8080/axis2/services/AsyncService";
 
+
     public ParallelAsyncTests(String str) {
         super(str);
     }
@@ -47,7 +49,7 @@
      * @wsdl async.wsdl + async.xml
      * @target AsyncPortImpl
      */
-    public void _testService_isAlive() throws Exception {
+    public void testService_isAlive() throws Exception {
         final String MESSAGE = "testServiceAlive";
 
         AsyncPort port = getPort(null);
@@ -56,6 +58,7 @@
         String req2 = "remappedAsync";
 
         for (int i = 0; i < 10; i++) {
+            
             Response<SleepResponse> resp1 = port.sleepAsync(req1);
             Response<CustomAsyncResponse> resp2 = port.remappedAsync(req2);
 
@@ -64,16 +67,26 @@
 
             waitBlocking(resp1);
         
+            String req1_result = null;
+            String req2_result = null;
             try {
-                String req1_result = resp1.get().getMessage();
-                String req2_result = resp2.get().getResponse();
+                req1_result = resp1.get().getMessage();
+                req2_result = resp2.get().getResponse();
             } catch (Exception e) {
                 e.printStackTrace();
                 fail(e.toString());
             }
 
+            assertEquals("sleepAsync did not return expected response ", req1, req1_result);
+            assertEquals("remappedAsync did not return expected response", req2, req2_result);
+            
+            // Calling get() again should return the same object as the first call to get()
             assertEquals("sleepAsync did not return expected response ", req1, resp1.get().getMessage());
             assertEquals("remappedAsync did not return expected response", req2, resp2.get().getResponse());
+            
+            // Change the request for the next time through the loop
+            req1 = req1+"!";
+            req2 = req2+"!";
         }
         
     }

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/WrapTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/WrapTests.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/WrapTests.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/WrapTests.java Wed Jan 31 12:35:21 2007
@@ -126,4 +126,50 @@
 			fail();
 		}
 	}
+    
+    /**
+     * This is a test of a doc/lit method that passes the 
+     * request in a header.  This can only be reproduced via
+     * annotations and WSGEN.  WSImport will not allow this.
+     */
+    public void testEchoStringWSGEN1() {
+        System.out.println("------------------------------");
+        System.out.println("Test : "+getName());
+        try{
+            String request = "hello world";
+            
+            DocLitWrapService service = new DocLitWrapService();
+            DocLitWrap proxy = service.getDocLitWrapPort();
+            String response = proxy.echoStringWSGEN1(request);
+            assertTrue(response.equals(request));
+            System.out.println("------------------------------");
+        }catch(Exception e){
+            e.printStackTrace();
+            fail();
+        }
+    }
+    
+    /**
+     * This is a test of a doc/lit method that passes the 
+     * response in a header.  This can only be reproduced via
+     * annotations and WSGEN.  WSImport will not allow this.
+     */
+    
+    public void testEchoStringWSGEN2() {
+        System.out.println("------------------------------");
+        System.out.println("Test : "+getName());
+        try{
+            String request = "hello world 2";
+            
+            DocLitWrapService service = new DocLitWrapService();
+            DocLitWrap proxy = service.getDocLitWrapPort();
+            String response = proxy.echoStringWSGEN2(request);
+            assertTrue(response.equals(request));
+            System.out.println("------------------------------");
+        }catch(Exception e){
+            e.printStackTrace();
+            fail();
+        }
+    }
+    
 }

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faults/FaultyWebServiceFault_Exception.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faults/FaultyWebServiceFault_Exception.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faults/FaultyWebServiceFault_Exception.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faults/FaultyWebServiceFault_Exception.java Wed Jan 31 12:35:21 2007
@@ -11,7 +11,8 @@
  * Generated source version: 2.0
  * 
  */
-@WebFault(faultBean="org.test.faults.FaultyWebServiceFault", name = "FaultyWebServiceFault", targetNamespace = "http://org/test/faults")
+// annotation is commented as part of the test to make sure defaults are used
+//@WebFault(faultBean="org.test.faults.FaultyWebServiceFault", name = "FaultyWebServiceFault", targetNamespace = "http://org/test/faults")
 public class FaultyWebServiceFault_Exception
     extends Exception
 {

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java Wed Jan 31 12:35:21 2007
@@ -15,11 +15,14 @@
 
 import javax.jws.WebService;
 import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFactory;
 import javax.xml.soap.SOAPFault;
 import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
@@ -108,8 +111,26 @@
                 soapFault.setFaultActor("actor");
                 throw new SOAPFaultException(soapFault);
             } catch (SOAPException se) {}
+        } else if (b.equals("SOAPFaultException2")) {
+            try {
+                SOAPFault soapFault = createSOAPFault();
+                soapFault.setFaultString("hello world2");
+                QName faultCode = new QName("urn://sample", "faultCode2");
+                soapFault.setFaultCode(faultCode);
+                soapFault.setFaultActor("actor2");
+                Detail detail = soapFault.addDetail();
+                DetailEntry de = detail.addDetailEntry(new QName("urn://sample", "detailEntry"));
+                de.setValue("Texas");
+                throw new SOAPFaultException(soapFault);
+            } catch (SOAPException se) {}
         } else if (b.equals("NPE")) {
             throw new NullPointerException();
+        } else if (b.equals("NPE2")) {
+            // Throw NPE with a message
+            throw new NullPointerException("Null Pointer Exception occurred");
+        } else if (b.equals("WSE")) {
+            WebServiceException wsf = new WebServiceException("This is a WebServiceException");
+            throw wsf;
         }
         return 0;
     }

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/InvalidTickerFault_Exception.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/InvalidTickerFault_Exception.java?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/InvalidTickerFault_Exception.java (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/InvalidTickerFault_Exception.java Wed Jan 31 12:35:21 2007
@@ -4,13 +4,16 @@
 import javax.xml.ws.WebFault;
 
 /**
- * This is an example of a legacy exception (InvalidTickerFault) which may be the result of a JAX-RPC emission.
+ * This is an example of a legacy exception  which may be the result of a JAX-RPC emission.
  * The fault does not have the valid constructors and lacks a getFaultInfo method.
  * However (in this case) the fault has a @WebFault that identifies the faultbean
  */
 @WebFault(name = "InvalidTickerFault", 
         targetNamespace = "http://org/test/polymorphicfaults",
-        faultBean="org.test.polymorphicfaults.InvalidTickerFaultBean")
+        faultBean="org.test.polymorphicfaults.InvalidTickerFaultExceptionBean")
+        
+        // faultBean is intentionally not specified. It should default to 
+        // faultBean="org.test.polymorphicfaults.InvalidTickerFault_ExceptionBean"
 public class InvalidTickerFault_Exception
     extends Exception
 {

Modified: webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/META-INF/FaultsService.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/META-INF/FaultsService.wsdl?view=diff&rev=501978&r1=501977&r2=501978
==============================================================================
--- webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/META-INF/FaultsService.wsdl (original)
+++ webservices/axis2/branches/java/maven2/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/META-INF/FaultsService.wsdl Wed Jan 31 12:35:21 2007
@@ -11,11 +11,12 @@
     <xsd:schema targetNamespace="http://org/test/polymorphicfaults">
         
       <xsd:element name="SimpleFault" type="xsd:int"/>
-      <xsd:element name="InvalidTickerFault" type="ts:InvalidTickerFaultBean"/>
-      <xsd:complexType name="InvalidTickerFaultBean">
+      <xsd:element name="InvalidTickerFault" type="ts:InvalidTickerFault_ExceptionBean"/>
+      <xsd:complexType name="InvalidTickerFault_ExceptionBean">
         <xsd:sequence>
            <xsd:element name="legacyData1" type="xsd:string" />
            <xsd:element name="legacyData2" type="xsd:int" />
+           <xsd:element name="message" type="xsd:string" />
         </xsd:sequence>
       </xsd:complexType>
 



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


Mime
View raw message