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

svn commit: r511296 - in /webservices/axis2/trunk/java/modules/jaxws: ./ src/org/apache/axis2/jaxws/client/dispatch/ src/org/apache/axis2/jaxws/message/ src/org/apache/axis2/jaxws/message/impl/ src/org/apache/axis2/jaxws/server/dispatcher/ src/org/apac...

Author: scheu
Date: Sat Feb 24 08:24:05 2007
New Revision: 511296

URL: http://svn.apache.org/viewvc?view=rev&rev=511296
Log:
AXIS2-1783
Contributor: Rich Scheuerle
Added XML/HTTP tests.  Added support for both Message and Payload modes.  (Attachment support is still missing)

Added:
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/datasource/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/datasource/DispatchXMessageDataSource.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/jaxb/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/jaxb/DispatchXPayloadJAXB.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXMessageString.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/   (with props)
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/MANIFEST.MF
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/services.xml
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/XMessageDataSourceProvider.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/MANIFEST.MF
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/services.xml
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/XMessageSourceProvider.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/MANIFEST.MF
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/services.xml
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/XMessageStringProvider.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/MANIFEST.MF
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/services.xml
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/XPayloadSourceProvider.java
Modified:
    webservices/axis2/trunk/java/modules/jaxws/maven.xml
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatch.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatch.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLPart.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageFactoryImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXPayloadString.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/string/XPayloadStringProvider.java

Modified: webservices/axis2/trunk/java/modules/jaxws/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/maven.xml?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws/maven.xml Sat Feb 24 08:24:05 2007
@@ -453,6 +453,42 @@
 		  </ant:fileset>
 		</ant:copy>
 		
+		<ant:copy toDir="target/test-classes/services/XMessageStringProvider/">
+		  <ant:fileset dir="target/test-classes">
+		    <ant:include name="org/apache/axis2/jaxws/xmlhttp/provider/message/string/*.class"/>
+		  </ant:fileset>
+		  <ant:fileset dir="test/org/apache/axis2/jaxws/xmlhttp/provider/message/string">
+		    <ant:include name="META-INF/**"/>
+		  </ant:fileset>
+		</ant:copy>
+		
+		<ant:copy toDir="target/test-classes/services/XPayloadSourceProvider/">
+		  <ant:fileset dir="target/test-classes">
+		    <ant:include name="org/apache/axis2/jaxws/xmlhttp/provider/payload/source/*.class"/>
+		  </ant:fileset>
+		  <ant:fileset dir="test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source">
+		    <ant:include name="META-INF/**"/>
+		  </ant:fileset>
+		</ant:copy>
+		
+		<ant:copy toDir="target/test-classes/services/XMessageSourceProvider/">
+		  <ant:fileset dir="target/test-classes">
+		    <ant:include name="org/apache/axis2/jaxws/xmlhttp/provider/message/source/*.class"/>
+		  </ant:fileset>
+		  <ant:fileset dir="test/org/apache/axis2/jaxws/xmlhttp/provider/message/source">
+		    <ant:include name="META-INF/**"/>
+		  </ant:fileset>
+		</ant:copy>
+		
+		<ant:copy toDir="target/test-classes/services/XMessageDataSourceProvider/">
+		  <ant:fileset dir="target/test-classes">
+		    <ant:include name="org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/*.class"/>
+		  </ant:fileset>
+		  <ant:fileset dir="test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource">
+		    <ant:include name="META-INF/**"/>
+		  </ant:fileset>
+		</ant:copy>
+		
 		<!-- ================================================================ -->
         <!--- Java Bean Endpoint Samples -->
         <!-- ================================================================ -->

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatch.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatch.java Sat Feb 24 08:24:05 2007
@@ -20,7 +20,6 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service.Mode;
 
-import org.apache.axiom.om.OMElement;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.client.async.AsyncResponse;
 import org.apache.axis2.jaxws.description.EndpointDescription;
@@ -31,7 +30,6 @@
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
 import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
 import org.apache.axis2.jaxws.message.factory.MessageFactory;
-import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.spi.ServiceDelegate;
 import org.apache.axis2.jaxws.utility.XMLRootElementUtil;
@@ -132,21 +130,14 @@
                     value = null;
                 }
             } else {
-                // This is a very strange case, the user would need
-                // to have a JAXB object that represents the message (i.e. SOAPEnvelope)
-                
-                // TODO: This doesn't seem right to me. We should not have an intermediate StringBlock.  
-                // This is not performant. Scheu 
-                OMElement messageOM = message.getAsOMElement();
-                String stringValue = messageOM.toString();  
-                QName soapEnvQname = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
-                
-                XMLStringBlockFactory stringFactory = (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
-                Block stringBlock = stringFactory.createFrom(stringValue, null, soapEnvQname);   
                 BlockFactory factory = (BlockFactory) FactoryRegistry.getFactory(JAXBBlockFactory.class);
                 JAXBBlockContext context = new JAXBBlockContext(jaxbContext);
-                Block block = factory.createFrom(stringBlock, context);
-                value = block.getBusinessObject(true);   
+                value = message.getValue(context, factory);
+                if (value == null) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("There are no elements to unmarshal.  JAXBDispatch returns a null value");
+                    }
+                }
             }
         } catch (Exception e) {
             throw ExceptionFactory.makeWebServiceException(e);

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatch.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatch.java Sat Feb 24 08:24:05 2007
@@ -16,7 +16,6 @@
  */
 package org.apache.axis2.jaxws.client.dispatch;
 
-import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.stream.XMLStreamException;
@@ -24,7 +23,6 @@
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.Service.Mode;
 
-import org.apache.axiom.om.OMElement;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.client.async.AsyncResponse;
 import org.apache.axis2.jaxws.description.EndpointDescription;
@@ -43,7 +41,6 @@
 
 public class XMLDispatch<T> extends BaseDispatch<T> {
     private static final Log log = LogFactory.getLog(XMLDispatch.class);
-    private static QName SOAPENV_QNAME = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
     private Class type;
     private Class blockFactoryType;
     
@@ -168,27 +165,14 @@
                 }
 				
 			} else if (mode.equals(Mode.MESSAGE)) {
-			   if (blockFactoryType.equals(SOAPEnvelopeBlockFactory.class)) {
-				   // This is an indication that we are in SOAPMessage Dispatch
-				   // Return the SOAPMessage
-				   value = message.getAsSOAPMessage();
-				   
-			   } else {
-                   // NOTE Similar code in JAXBDispatch
-                   
-				   // TODO: This doesn't seem right to me. We should not have an intermediate StringBlock.  
-				   // This is not performant. Scheu 
-				   OMElement messageOM = message.getAsOMElement();
-				   String stringValue = messageOM.toString();  
-				   QName soapEnvQname = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
-                    
-				   XMLStringBlockFactory stringFactory = (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
-				   Block stringBlock = stringFactory.createFrom(stringValue, null, soapEnvQname);   
-				   BlockFactory factory = (BlockFactory) FactoryRegistry.getFactory(blockFactoryType);
-				   block = factory.createFrom(stringBlock, null);
-				   value = block.getBusinessObject(true);
-			   }
-			}
+                BlockFactory factory = (BlockFactory) FactoryRegistry.getFactory(blockFactoryType);
+                value = message.getValue(null, factory);
+                if (value == null) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("There are no elements to unmarshal.  XMLDispatch returns a null value");
+                    }
+                }
+            }
             
         } catch (Exception e) {
             if (log.isDebugEnabled()) {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java Sat Feb 24 08:24:05 2007
@@ -23,6 +23,8 @@
 import javax.xml.soap.SOAPMessage;
 import javax.xml.ws.WebServiceException;
 
+import org.apache.axis2.jaxws.message.factory.BlockFactory;
+
 /**
  * Message
  * 
@@ -118,4 +120,12 @@
      * @return true if post pivot
      */
     public boolean isPostPivot();
+    
+    /* 
+     * Get the entire message rendered in a certain type of value (i.e. String, Source, SOAPMessage, etc.)
+     * @param context
+     * @param blockFactory blockfactory associated with the kind of rendering
+     */
+    public Object getValue(Object context, BlockFactory blockFactory)  
+        throws WebServiceException;
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLPart.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLPart.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLPart.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLPart.java Sat Feb 24 08:24:05 2007
@@ -177,25 +177,12 @@
 	
 	/**
 	 * getAsOMElement
-	 * Get the xml part as a read/write OM
-	 * @return OMElement (probably OM SOAPEnvelope)
+	 * Get the xml part as a read/write OM...note this returns an OM SOAPEnvelope
+     * for all protocols...even REST
+	 * @return OMElement
 	 * @throws WebServiceException
 	 */
 	public OMElement getAsOMElement() throws WebServiceException;
-	
-	/**
-	 * getAsBlock
-	 * Get the entire xml part as a Block
-	 * The BlockFactory and object context are passed in to help create the 
-	 * proper kind of block.
-	 * 
-	 * @return Block
-	 * @throws WebServiceException
-	 */
-	public Block getAsBlock(
-			Object context, 
-			BlockFactory blockFactory)  
-		throws WebServiceException, XMLStreamException;
 	
 	/**
 	 * getNumBodyBlocks

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageFactoryImpl.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageFactoryImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageFactoryImpl.java Sat Feb 24 08:24:05 2007
@@ -25,6 +25,7 @@
 import javax.xml.ws.WebServiceException;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axis2.jaxws.ExceptionFactory;
@@ -52,9 +53,16 @@
 	 * @see org.apache.axis2.jaxws.message.factory.MessageFactory#createFrom(javax.xml.stream.XMLStreamReader)
 	 */
 	public Message createFrom(XMLStreamReader reader, Protocol protocol) throws XMLStreamException, WebServiceException {
-		StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, null);  // Pass null has the version to trigger autodetection
-		SOAPEnvelope omEnvelope = builder.getSOAPEnvelope();
-		return createFrom(omEnvelope, protocol);
+        StAXOMBuilder builder;
+        if (protocol == Protocol.rest) {
+            // Build a normal OM tree
+            builder = new StAXOMBuilder(reader);
+        } else {
+            // Build a SOAP OM tree
+            builder = new StAXSOAPModelBuilder(reader, null);  // Pass null as the version to trigger autodetection
+        }
+        OMElement omElement = builder.getDocumentElement();
+		return createFrom(omElement, protocol);
 	}
 
 	/* (non-Javadoc)

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java Sat Feb 24 08:24:05 2007
@@ -28,6 +28,7 @@
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPConstants;
 import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.stream.XMLStreamException;
@@ -47,11 +48,15 @@
 import org.apache.axis2.jaxws.message.XMLPart;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
 import org.apache.axis2.jaxws.message.factory.SAAJConverterFactory;
+import org.apache.axis2.jaxws.message.factory.SOAPEnvelopeBlockFactory;
 import org.apache.axis2.jaxws.message.factory.XMLPartFactory;
+import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
 import org.apache.axis2.jaxws.message.util.MessageUtils;
 import org.apache.axis2.jaxws.message.util.SAAJConverter;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 
+import com.ibm.xslt4j.bcel.generic.RETURN;
+
 /**
  * MessageImpl
  * A Message is an XML part + Attachments.
@@ -73,12 +78,6 @@
     private MimeHeaders mimeHeaders = new MimeHeaders(); 
     
     private boolean postPivot = false;
-    
-	// Constants
-	private static final String SOAP11_ENV_NS = "http://schemas.xmlsoap.org/soap/envelope/";
-	private static final String SOAP12_ENV_NS = "http://www.w3.org/2003/05/soap-envelope";
-	private static final String SOAP11_CONTENT_TYPE ="text/xml";
-	private static final String SOAP12_CONTENT_TYPE = "application/soap+xml";
 	
 	/**
 	 * MessageImpl should be constructed via the MessageFactory.
@@ -187,10 +186,10 @@
 
 			// Toggle based on SOAP 1.1 or SOAP 1.2
 			String contentType = null;
-			if (ns.getNamespaceURI().equals(SOAP11_ENV_NS)) {
-				contentType = SOAP11_CONTENT_TYPE;
+			if (ns.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE)) {
+				contentType = SOAPConstants.SOAP_1_1_CONTENT_TYPE;
 			} else {
-				contentType = SOAP12_CONTENT_TYPE;
+				contentType = SOAPConstants.SOAP_1_2_CONTENT_TYPE;
 			}
             
             // Override the content-type
@@ -214,15 +213,45 @@
 
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.axis2.jaxws.message.XMLPart#getAsBlock(java.lang.Object,
-	 *      org.apache.axis2.jaxws.message.factory.BlockFactory)
-	 */
-	public Block getAsBlock(Object context, BlockFactory blockFactory) throws WebServiceException, XMLStreamException {
-		return xmlPart.getAsBlock(context, blockFactory);
-	}
+	
+    /* (non-Javadoc)
+     * @see org.apache.axis2.jaxws.message.Message#getValue(java.lang.Object, org.apache.axis2.jaxws.message.factory.BlockFactory)
+     */
+    public Object getValue(Object context, BlockFactory blockFactory) throws WebServiceException {
+        try {
+            Object value = null;
+            if (protocol == Protocol.rest) {
+                // The implementation of rest stores the rest xml inside a dummy soap 1.1 envelope.
+                // So use the get body block logic.
+                Block block = xmlPart.getBodyBlock(context, blockFactory);
+                if (block != null) {
+                    value = block.getBusinessObject(true);
+                }
+              
+            } else {
+                // Must be SOAP
+                if (blockFactory instanceof SOAPEnvelopeBlockFactory) {
+                    value = getAsSOAPMessage();
+                } else {
+                    // TODO: This doesn't seem right to me. We should not have an intermediate StringBlock.  
+                    // This is not performant. Scheu 
+                    OMElement messageOM = getAsOMElement();
+                    String stringValue = messageOM.toString();  
+                    String soapNS = (protocol == Protocol.soap11) ? SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE : SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE; 
+                    QName soapEnvQname = new QName(soapNS, "Envelope");
+
+                     
+                    XMLStringBlockFactory stringFactory = (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
+                    Block stringBlock = stringFactory.createFrom(stringValue, null, soapEnvQname);   
+                    Block block = blockFactory.createFrom(stringBlock, context);
+                    value = block.getBusinessObject(true);
+                }
+            }
+            return value;
+        } catch (Throwable e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
 
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.message.XMLPart#getAttachments()
@@ -275,6 +304,7 @@
 		return protocol;
 	}
 
+    
 	public OMElement getAsOMElement() throws WebServiceException {
 		return xmlPart.getAsOMElement();
 	}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java Sat Feb 24 08:24:05 2007
@@ -152,7 +152,8 @@
             } else if (qName.getNamespaceURI().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
                 throw ExceptionFactory.makeWebServiceException("UNEXPECTED");  // TODO NLS
             } else {
-                _createSpine(Protocol.rest, Style.DOCUMENT, 0, root);
+                content = _createSpine(Protocol.rest, Style.DOCUMENT, 0, root);
+                contentType = SPINE;
             }
         }
 	}
@@ -252,26 +253,6 @@
 	 */
 	public SOAPEnvelope getAsSOAPEnvelope() throws WebServiceException {
 		return getContentAsSOAPEnvelope();
-	}
-
-	/* (non-Javadoc)
-	 * @see org.apache.axis2.jaxws.message.XMLPart#getAsBlock(java.lang.Object, org.apache.axis2.jaxws.message.factory.BlockFactory)
-	 */
-	public Block getAsBlock(Object context, BlockFactory blockFactory) throws WebServiceException, XMLStreamException {
-		
-		// Get the content as the specfied block.  There is some optimization here to prevent unnecessary copies.
-		// More optimization may be added later.
-		Block block = null;
-		if (contentType == OM) {
-			block = blockFactory.createFrom((OMElement) content, context, null);
-		} else if (contentType == SOAPENVELOPE && 
-			blockFactory instanceof SOAPEnvelopeBlockFactory)	{
-			block = blockFactory.createFrom((SOAPEnvelope) content, null, null );
-		} else {
-			block = blockFactory.createFrom(getAsOMElement(), null, null);
-		}
-        block.setParent(getParent());
-		return block;
 	}
 
 	/* (non-Javadoc)

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java Sat Feb 24 08:24:05 2007
@@ -42,7 +42,9 @@
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.Protocol;
 import org.apache.axis2.jaxws.message.XMLFault;
+import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
+import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
 import org.apache.axis2.jaxws.message.factory.MessageFactory;
 import org.apache.axis2.jaxws.message.factory.SOAPEnvelopeBlockFactory;
 import org.apache.axis2.jaxws.message.factory.SourceBlockFactory;
@@ -119,28 +121,19 @@
             providerServiceMode = endpointDesc.getServiceMode();
             
             if (providerServiceMode != null && providerServiceMode == Service.Mode.MESSAGE) {
-                // For MESSAGE mode, work with the entire message, Headers and Body
-                // This is based on logic in org.apache.axis2.jaxws.client.XMLDispatch.getValueFromMessage()
                 if (providerType.equals(SOAPMessage.class)) {
                     // We can get the SOAPMessage directly from the message itself
                     if (log.isDebugEnabled()) {
                         log.debug("Provider Type is SOAPMessage.");
                         log.debug("Number Message attachments=" + message.getAttachments().size());
                     }
-                    requestParamValue = message.getAsSOAPMessage();
                 }
-                else {
-                    // For Source and String, we have to do some conversions using the block factories
-                    // This is similar to the PAYLOAD logic, except it gets the entire message as a block
-                    // rather than just the body block (which is what PAYLOAD mode does).
-                    // TODO: This doesn't seem right to me. We should not have an intermediate StringBlock. This is not performant. Scheu 
-                    OMElement messageOM = message.getAsOMElement();
-                    String stringValue = messageOM.toString();  
-                    QName soapEnvQname = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
-                    XMLStringBlockFactory stringFactory = (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
-                    Block stringBlock = stringFactory.createFrom(stringValue, null, soapEnvQname);   
-                    Block messageBlock = factory.createFrom(stringBlock, null);
-                    requestParamValue = messageBlock.getBusinessObject(true);
+                
+                requestParamValue = message.getValue(null, factory);
+                if (requestParamValue == null) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("There are no elements to unmarshal.  ProviderDispatch will pass a null as input");
+                    }
                 }
             }
             else {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java Sat Feb 24 08:24:05 2007
@@ -28,6 +28,7 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 
+import javax.activation.DataSource;
 import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPMessage;
@@ -350,6 +351,7 @@
     private boolean isValidDispatchType(Class clazz) {
     	return clazz != null && (clazz == String.class || 
     			clazz == Source.class || 
+                clazz == DataSource.class ||
     			clazz == SOAPMessage.class);
     }
     

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Sat Feb 24 08:24:05 2007
@@ -74,6 +74,11 @@
 import org.apache.axis2.jaxws.sample.WSGenTests;
 import org.apache.axis2.jaxws.sample.WrapTests;
 import org.apache.axis2.jaxws.security.BasicAuthSecurityTests;
+import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.datasource.DispatchXMessageDataSource;
+import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.jaxb.DispatchXPayloadJAXB;
+import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.source.DispatchXMessageSource;
+import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.source.DispatchXPayloadSource;
+import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.string.DispatchXMessageString;
 import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.string.DispatchXPayloadString;
 import org.apache.log4j.BasicConfigurator;
 
@@ -159,7 +164,13 @@
         suite.addTestSuite(PolymorphicTests.class);
         suite.addTestSuite(NS2PkgTest.class);
         suite.addTestSuite(JAXBContextTest.class);
+        
         suite.addTestSuite(DispatchXPayloadString.class);
+        suite.addTestSuite(DispatchXMessageString.class);
+        suite.addTestSuite(DispatchXPayloadSource.class);
+        suite.addTestSuite(DispatchXMessageSource.class);
+        suite.addTestSuite(DispatchXPayloadJAXB.class);
+        suite.addTestSuite(DispatchXMessageDataSource.class);
         
         // Start (and stop) the server only once for all the tests
         TestSetup testSetup = new TestSetup(suite) {

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/datasource/DispatchXMessageDataSource.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/datasource/DispatchXMessageDataSource.java?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/datasource/DispatchXMessageDataSource.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/datasource/DispatchXMessageDataSource.java Sat Feb 24 08:24:05 2007
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.datasource;
+
+import java.awt.Image;
+import java.io.File;
+
+import javax.activation.DataSource;
+import javax.imageio.ImageIO;
+import javax.imageio.stream.FileImageInputStream;
+import javax.imageio.stream.ImageInputStream;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.apache.axis2.jaxws.provider.DataSourceImpl;
+
+import junit.framework.TestCase;
+
+public class DispatchXMessageDataSource extends TestCase {
+
+    public String HOSTPORT = "http://localhost:8080";
+        
+    private String ENDPOINT_URL = HOSTPORT + "/axis2/services/XMessageDataSourceProvider";
+    private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2", "XMessageDataSourceProvider");
+    private QName PORT_NAME  = new QName("http://ws.apache.org/axis2", "XMessageDataSourceProviderPort");
+ 
+    
+    private DataSource imageDS;
+    
+    public void setUp() throws Exception {
+        String imageResourceDir = System.getProperty("basedir",".")+"/"+"test-resources"+File.separator+"image";
+        
+        //Create a DataSource from an image 
+        File file = new File(imageResourceDir+File.separator+"test.jpg");
+        ImageInputStream fiis = new FileImageInputStream(file);
+        Image image = ImageIO.read(fiis);
+        imageDS = new DataSourceImpl("image/jpeg","test.jpg",image);
+    }
+    
+    public Dispatch<DataSource> getDispatch() {
+       Service service = Service.create(SERVICE_NAME);
+       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+       Dispatch<DataSource> dispatch = service.createDispatch(PORT_NAME, DataSource.class, Service.Mode.MESSAGE);
+       return dispatch;
+    }
+    
+    /**
+     * Simple XML/HTTP Message Test
+     * @throws Exception
+     */
+    public void testSimple() throws Exception {
+        Dispatch<DataSource> dispatch = getDispatch();
+        DataSource request = imageDS;
+        
+        // TODO NOT IMPLEMENTED
+        
+        //DataSource response = dispatch.invoke(request);
+        //assertTrue(response != null);
+        //assertTrue(request.equals(response));
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/jaxb/DispatchXPayloadJAXB.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/jaxb/DispatchXPayloadJAXB.java?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/jaxb/DispatchXPayloadJAXB.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/jaxb/DispatchXPayloadJAXB.java Sat Feb 24 08:24:05 2007
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.jaxb;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.apache.axis2.jaxws.message.util.Reader2Writer;
+
+import test.EchoString;
+import test.EchoStringResponse;
+import test.ObjectFactory;
+
+import junit.framework.TestCase;
+
+public class DispatchXPayloadJAXB extends TestCase {
+    
+    private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+    public String HOSTPORT = "http://localhost:8080";
+        
+    private String ENDPOINT_URL = HOSTPORT + "/axis2/services/XPayloadSourceProvider";
+    private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2", "XPayloadSourceProvider");
+    private QName PORT_NAME  = new QName("http://ws.apache.org/axis2", "XPayloadSourceProviderPort");
+
+    String XML_TEXT = "<p:echo xmlns:p=\"http://sample\">hello world</p:echo>";
+    public Dispatch<Object> getDispatch() throws JAXBException {
+        Service service = Service.create(SERVICE_NAME);
+        service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+        JAXBContext jbc = JAXBContext.newInstance("test");
+        Dispatch<Object> dispatch = service.createDispatch(PORT_NAME, jbc, Service.Mode.PAYLOAD);
+        return dispatch;
+     }
+    
+    /**
+    * Simple XML/HTTP Message Test
+    * @throws Exception
+    */
+   public void testSimple() throws Exception {
+       Dispatch<Object> dispatch = getDispatch();
+       ObjectFactory factory = new ObjectFactory();
+       EchoString request = factory.createEchoString();         
+       request.setInput("SYNC JAXB XML PAYLOAD TEST");
+       
+       // Invoke the Dispatch<Object>
+       System.out.println(">> Invoking sync Dispatch with JAX-B Parameter");
+       EchoString response = (EchoString) dispatch.invoke(request);
+       
+       assertNotNull(response);
+       
+       System.out.println(">> Response content: " + response.getInput());
+       
+       assertTrue("[ERROR] - Response object was null", response != null);
+       assertTrue("[ERROR] - No content in response object", response.getInput() != null);
+       assertTrue("[ERROR] - Zero length content in response", response.getInput().length() > 0);
+       assertTrue(response.getInput().equals(request.getInput()));
+
+   }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXMessageString.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXMessageString.java?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXMessageString.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXMessageString.java Sat Feb 24 08:24:05 2007
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.string;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.http.HTTPBinding;
+
+import junit.framework.TestCase;
+
+public class DispatchXMessageString extends TestCase {
+
+    public String HOSTPORT = "http://localhost:8080";
+        
+    private String ENDPOINT_URL = HOSTPORT + "/axis2/services/XMessageStringProvider";
+    private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2", "XMessageStringProvider");
+    private QName PORT_NAME  = new QName("http://ws.apache.org/axis2", "XMessageStringProviderPort");
+ 
+    private static String XML_TEXT = "<p:echo xmlns:p=\"http://sample\">hello world</p:echo>";
+    private static String XML_TEXT_NPE = "<p:echo xmlns:p=\"http://sample\">NPE</p:echo>";
+    
+    public Dispatch<String> getDispatch() {
+       Service service = Service.create(SERVICE_NAME);
+       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+       Dispatch<String> dispatch = service.createDispatch(PORT_NAME, String.class, Service.Mode.MESSAGE);
+       return dispatch;
+    }
+    
+    /**
+     * Simple XML/HTTP Message Test
+     * @throws Exception
+     */
+    public void testSimple() throws Exception {
+        Dispatch<String> dispatch = getDispatch();
+        String request = XML_TEXT;
+        System.out.println("Request  = " + request);
+        String response = dispatch.invoke(request);
+        System.out.println("Response = " + response);
+        assertTrue(response != null);
+        assertTrue(request.equals(response));
+    }
+    
+    /**
+     * TODO Need to fix the implementation and test
+     * @throws Exception
+     */
+    public void _testEmpty() throws Exception {
+        Dispatch<String> dispatch = getDispatch();
+        String request = "";
+        System.out.println("Request  = " + request);
+        String response = dispatch.invoke(request);
+        System.out.println("Response = " + response);
+        assertTrue(response != null);
+        assertTrue(request.equals(response));
+    }
+    
+    /**
+     * TODO Need to fix the implementation and test
+     * @throws Exception
+     */
+    public void _testNull() throws Exception {
+        Dispatch<String> dispatch = getDispatch();
+        String request = null;
+        System.out.println("Request  = " + request);
+        String response = dispatch.invoke(request);
+        System.out.println("Response = " + response);
+        assertTrue(response != null);
+        assertTrue(request.equals(response));
+    }
+    
+    /**
+     * TODO Need to fix the implementation and test
+     * @throws Exception
+     */
+    public void _testException() throws Exception {
+        Dispatch<String> dispatch = getDispatch();
+        String request = XML_TEXT_NPE;
+        System.out.println("Request  = " + request);
+        String response = dispatch.invoke(request);
+        System.out.println("Response = " + response);
+        assertTrue(response != null);
+        assertTrue(request.equals(response));
+    }
+}
+

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXPayloadString.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXPayloadString.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXPayloadString.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXPayloadString.java Sat Feb 24 08:24:05 2007
@@ -31,7 +31,9 @@
     private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2", "XPayloadStringProvider");
     private QName PORT_NAME  = new QName("http://ws.apache.org/axis2", "XPayloadStringProviderPort");
  
-    String XML_TEXT = "<p:echo xmlns:p=\"http://sample\">hello world</p:echo>";
+    private static String XML_TEXT = "<p:echo xmlns:p=\"http://sample\">hello world</p:echo>";
+    private static String XML_TEXT_NPE = "<p:echo xmlns:p=\"http://sample\">NPE</p:echo>";
+    
     public Dispatch<String> getDispatch() {
        Service service = Service.create(SERVICE_NAME);
        service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
@@ -46,6 +48,48 @@
     public void testSimple() throws Exception {
         Dispatch<String> dispatch = getDispatch();
         String request = XML_TEXT;
+        System.out.println("Request  = " + request);
+        String response = dispatch.invoke(request);
+        System.out.println("Response = " + response);
+        assertTrue(response != null);
+        assertTrue(request.equals(response));
+    }
+    
+    /**
+     * TODO Need to fix the implementation and test
+     * @throws Exception
+     */
+    public void _testEmpty() throws Exception {
+        Dispatch<String> dispatch = getDispatch();
+        String request = "";
+        System.out.println("Request  = " + request);
+        String response = dispatch.invoke(request);
+        System.out.println("Response = " + response);
+        assertTrue(response != null);
+        assertTrue(request.equals(response));
+    }
+    
+    /**
+     * TODO Need to fix the implementation and test
+     * @throws Exception
+     */
+    public void _testNull() throws Exception {
+        Dispatch<String> dispatch = getDispatch();
+        String request = null;
+        System.out.println("Request  = " + request);
+        String response = dispatch.invoke(request);
+        System.out.println("Response = " + response);
+        assertTrue(response != null);
+        assertTrue(request.equals(response));
+    }
+    
+    /**
+     * TODO Need to fix the implementation and test
+     * @throws Exception
+     */
+    public void _testException() throws Exception {
+        Dispatch<String> dispatch = getDispatch();
+        String request = XML_TEXT_NPE;
         System.out.println("Request  = " + request);
         String response = dispatch.invoke(request);
         System.out.println("Response = " + response);

Propchange: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Feb 24 08:24:05 2007
@@ -0,0 +1,2 @@
+
+META-INF

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/MANIFEST.MF?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/MANIFEST.MF (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/MANIFEST.MF Sat Feb 24 08:24:05 2007
@@ -0,0 +1 @@
+Manifest-Version: 1.0
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/services.xml?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/META-INF/services.xml Sat Feb 24 08:24:05 2007
@@ -0,0 +1,14 @@
+<serviceGroup>
+ <service name="XMessageDataSourceProvider">
+  <messageReceivers>
+   <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+  </messageReceivers>
+  <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.xmlhttp.provider.message.datasource.XMessageDataSourceProvider</parameter>
+  <excludeOperations>
+     <operation>invoke</operation>
+  </excludeOperations>
+  <operation name="echo" mep="http://www.w3.org/2004/08/wsdl/in-out">
+    <actionMapping/>
+  </operation>
+ </service>
+</serviceGroup>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/XMessageDataSourceProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/XMessageDataSourceProvider.java?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/XMessageDataSourceProvider.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/datasource/XMessageDataSourceProvider.java Sat Feb 24 08:24:05 2007
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.xmlhttp.provider.message.datasource;
+
+import javax.activation.DataSource;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
+
+/**
+ * Sample XML/HTTP DataSource Provider 
+ */
+@WebServiceProvider()
+@BindingType(HTTPBinding.HTTP_BINDING)
+@ServiceMode(value=Service.Mode.MESSAGE)
+public class XMessageDataSourceProvider implements Provider<DataSource> {
+
+    public DataSource invoke(DataSource input) {
+        return input;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/MANIFEST.MF?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/MANIFEST.MF (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/MANIFEST.MF Sat Feb 24 08:24:05 2007
@@ -0,0 +1 @@
+Manifest-Version: 1.0
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/services.xml?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/META-INF/services.xml Sat Feb 24 08:24:05 2007
@@ -0,0 +1,14 @@
+<serviceGroup>
+ <service name="XMessageSourceProvider">
+  <messageReceivers>
+   <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+  </messageReceivers>
+  <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.xmlhttp.provider.message.source.XMessageSourceProvider</parameter>
+  <excludeOperations>
+     <operation>invoke</operation>
+  </excludeOperations>
+  <operation name="echo" mep="http://www.w3.org/2004/08/wsdl/in-out">
+    <actionMapping/>
+  </operation>
+ </service>
+</serviceGroup>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/XMessageSourceProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/XMessageSourceProvider.java?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/XMessageSourceProvider.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/source/XMessageSourceProvider.java Sat Feb 24 08:24:05 2007
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.xmlhttp.provider.message.source;
+
+import javax.xml.transform.Source;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
+
+/**
+ * Sample XML/HTTP String Provider 
+ */
+@WebServiceProvider()
+@BindingType(HTTPBinding.HTTP_BINDING)
+@ServiceMode(value=Service.Mode.MESSAGE)
+public class XMessageSourceProvider implements Provider<Source> {
+
+    public Source invoke(Source input) {
+        return input;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/MANIFEST.MF?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/MANIFEST.MF (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/MANIFEST.MF Sat Feb 24 08:24:05 2007
@@ -0,0 +1 @@
+Manifest-Version: 1.0
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/services.xml?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/META-INF/services.xml Sat Feb 24 08:24:05 2007
@@ -0,0 +1,14 @@
+<serviceGroup>
+ <service name="XMessageStringProvider">
+  <messageReceivers>
+   <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+  </messageReceivers>
+  <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.xmlhttp.provider.message.string.XMessageStringProvider</parameter>
+  <excludeOperations>
+     <operation>invoke</operation>
+  </excludeOperations>
+  <operation name="echo" mep="http://www.w3.org/2004/08/wsdl/in-out">
+    <actionMapping/>
+  </operation>
+ </service>
+</serviceGroup>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/XMessageStringProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/XMessageStringProvider.java?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/XMessageStringProvider.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/message/string/XMessageStringProvider.java Sat Feb 24 08:24:05 2007
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.xmlhttp.provider.message.string;
+
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
+
+/**
+ * Sample XML/HTTP String Provider 
+ */
+@WebServiceProvider()
+@BindingType(HTTPBinding.HTTP_BINDING)
+@ServiceMode(value=Service.Mode.MESSAGE)
+public class XMessageStringProvider implements Provider<String> {
+
+    public String invoke(String input) {
+        if (input.contains("NPE")) {
+            throw new NullPointerException("NPE Thrown!");
+        }
+        return input;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/MANIFEST.MF?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/MANIFEST.MF (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/MANIFEST.MF Sat Feb 24 08:24:05 2007
@@ -0,0 +1 @@
+Manifest-Version: 1.0
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/services.xml?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/META-INF/services.xml Sat Feb 24 08:24:05 2007
@@ -0,0 +1,17 @@
+<serviceGroup>
+ <service name="XPayloadSourceProvider">
+  <messageReceivers>
+   <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+  </messageReceivers>
+  <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.xmlhttp.provider.payload.source.XPayloadSourceProvider</parameter>
+  <excludeOperations>
+     <operation>invoke</operation>
+  </excludeOperations>
+  <operation name="echo" mep="http://www.w3.org/2004/08/wsdl/in-out">
+    <actionMapping/>
+  </operation>
+  <operation name="echoString" mep="http://www.w3.org/2004/08/wsdl/in-out">
+    <actionMapping/>
+  </operation>
+ </service>
+</serviceGroup>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/XPayloadSourceProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/XPayloadSourceProvider.java?view=auto&rev=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/XPayloadSourceProvider.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/source/XPayloadSourceProvider.java Sat Feb 24 08:24:05 2007
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.xmlhttp.provider.payload.source;
+
+import javax.xml.transform.Source;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
+
+/**
+ * Sample XML/HTTP String Provider 
+ */
+@WebServiceProvider()
+@BindingType(HTTPBinding.HTTP_BINDING)
+public class XPayloadSourceProvider implements Provider<Source> {
+
+    public Source invoke(Source input) {
+        return input;
+    }
+
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/string/XPayloadStringProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/string/XPayloadStringProvider.java?view=diff&rev=511296&r1=511295&r2=511296
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/string/XPayloadStringProvider.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/provider/payload/string/XPayloadStringProvider.java Sat Feb 24 08:24:05 2007
@@ -29,6 +29,9 @@
 public class XPayloadStringProvider implements Provider<String> {
 
     public String invoke(String input) {
+        if (input.contains("NPE")) {
+            throw new NullPointerException("NPE Thrown!");
+        }
         return input;
     }
 



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