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

svn commit: r509789 - in /webservices/axis2/trunk/java/modules/jaxws: ./ src/org/apache/axis2/jaxws/marshaller/factory/ src/org/apache/axis2/jaxws/marshaller/impl/alt/ test-resources/xsd/ test/org/apache/axis2/jaxws/framework/ test/org/apache/axis2/jax...

Author: scheu
Date: Tue Feb 20 14:47:28 2007
New Revision: 509789

URL: http://svn.apache.org/viewvc?view=rev&rev=509789
Log:
AXIS2-2155 First Patch
Contributor: Rich Scheuerle
Test and implementation foundation for the doc/lit wrapped "minimal" support

Added:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java
    webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/greeterTypes.xsd
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/DLWMinTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/GreeterImpl.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/greeter.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/greeterTypes.xsd
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/services.xml
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/sei/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/sei/Greeter.java
Modified:
    webservices/axis2/trunk/java/modules/jaxws/maven.xml
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.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=509789&r1=509788&r2=509789
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws/maven.xml Tue Feb 20 14:47:28 2007
@@ -188,6 +188,14 @@
             <classpath location="${compiled.classes.dir}"/>
             <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/doclitbare.wsdl"/>
         </java>
+        
+        <ant:echo>Generating java from greeterTypes.xsd</ant:echo>
+        <java classname="com.sun.tools.xjc.Driver" fork="true"> 
+            <jvmarg line="${maven.junit.jvmargs2}"/>
+            <classpath refid="maven.dependency.classpath"/>
+            <classpath location="${compiled.classes.dir}"/>
+            <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/greeterTypes.xsd"/>
+        </java>
 
     	<ant:echo>Generating java from EchoMessage.wsdl for javabean endpoint support</ant:echo>
    	    <java classname="com.sun.tools.xjc.Driver" fork="true"> 
@@ -500,6 +508,19 @@
 			   <ant:include name="org/apache/axis2/jaxws/server/**"/>
 			</ant:fileset>
 		</ant:copy>
+		
+		<ant:copy toDir="target/test-classes/services/GreeterService/">
+			<ant:fileset dir="target/test-classes">
+			   <ant:include name="org/apache/axis2/jaxws/sample/dlwmin/**"/>
+			</ant:fileset>
+			<ant:fileset dir="test/org/apache/axis2/jaxws/sample/dlwmin">
+			   <ant:include name="META-INF/**"/>
+			</ant:fileset>
+			<ant:fileset dir="target/classes">
+			   <ant:include name="org/apache/axis2/jaxws/server/**"/>
+			</ant:fileset>
+		</ant:copy>
+		
 		<ant:copy toDir="target/test-classes/services/AsyncService/">
 			<ant:fileset dir="target/test-classes">
 			   <ant:include name="org/apache/axis2/jaxws/sample/parallelasync/**"/>

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java?view=diff&rev=509789&r1=509788&r2=509789
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java Tue Feb 20 14:47:28 2007
@@ -21,10 +21,14 @@
 import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
 import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitBareMethodMarshaller;
 import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMethodMarshaller;
+import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
 import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedPlusMethodMarshaller;
 import org.apache.axis2.jaxws.marshaller.impl.alt.RPCLitMethodMarshaller;
+import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
+import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescriptionFactory;
 import org.apache.axis2.jaxws.description.OperationDescription;
 import org.apache.axis2.jaxws.description.ParameterDescription;
+import org.apache.axis2.jaxws.description.ServiceDescription;
 
 /**
  * The MethodMarshallerFactory creates a Doc/Lit Wrapped, Doc/Lit Bare or RPC Marshaller using SOAPBinding information
@@ -32,6 +36,7 @@
 public class MethodMarshallerFactory {
 
     
+    private enum SUBTYPE {NORMAL, DLW_WSGEN_PLUS, DLW_MINIMAL };
     
 	/**
 	 * Intentionally private
@@ -49,15 +54,18 @@
      */
     private static MethodMarshaller createMethodMarshaller(SOAPBinding.Style style, 
             SOAPBinding.ParameterStyle paramStyle,
-            boolean isPlus, 
+            SUBTYPE subType, 
             boolean isClient){  // This flag is for testing only !
 		if (style == SOAPBinding.Style.RPC) {
             return new RPCLitMethodMarshaller();  
         } else if (paramStyle == SOAPBinding.ParameterStyle.WRAPPED){
-            if (isPlus) {
+            if (subType == SUBTYPE.DLW_WSGEN_PLUS) {
                 // Abnormal case
                 return new DocLitWrappedPlusMethodMarshaller();
-            } else {
+            } else if (subType == SUBTYPE.DLW_MINIMAL) {
+                // Abnormal case
+                return new DocLitWrappedMinimalMethodMarshaller();
+            }else {
                 return new DocLitWrappedMethodMarshaller();  
             }
 		} else if (paramStyle == SOAPBinding.ParameterStyle.BARE){
@@ -87,20 +95,22 @@
 
     private static MethodMarshaller createDocLitMethodMarshaller(OperationDescription op, boolean isClient){
         SOAPBinding.ParameterStyle parameterStyle = null;
-        boolean isPlus = false;
+        SUBTYPE subType = SUBTYPE.NORMAL;
         if(isDocLitBare(op)){
             parameterStyle = SOAPBinding.ParameterStyle.BARE;
-        } else if (isDocLitWrappedPlus(op)) {
-            parameterStyle = SOAPBinding.ParameterStyle.WRAPPED;
-            isPlus = true;
-        } else if(isDocLitWrapped(op)){
+        } else { 
+            if (isDocLitWrappedPlus(op)) {
+                subType = SUBTYPE.DLW_WSGEN_PLUS;
+            } else if (isDocLitWrappedMinimal(op)) {
+                subType = SUBTYPE.DLW_MINIMAL;
+            }
             parameterStyle = SOAPBinding.ParameterStyle.WRAPPED;
         }
-        return createMethodMarshaller(SOAPBinding.Style.DOCUMENT, parameterStyle, isPlus, isClient);
+        return createMethodMarshaller(SOAPBinding.Style.DOCUMENT, parameterStyle, subType, isClient);
     }
 
     private static MethodMarshaller createRPCLitMethodMarshaller(boolean isClient){
-        return createMethodMarshaller(SOAPBinding.Style.RPC, SOAPBinding.ParameterStyle.WRAPPED, false, isClient);
+        return createMethodMarshaller(SOAPBinding.Style.RPC, SOAPBinding.ParameterStyle.WRAPPED, SUBTYPE.NORMAL, isClient);
     }
 
     protected static boolean isDocLitBare(OperationDescription op){
@@ -147,5 +157,39 @@
             }
         }
         return false;
+    }
+    
+    /**
+     * If an web service is created without wsgen, it is possible that the
+     * wrapper elements are missing.  In such cases, use the doc/lit wrapped minimal marshaller
+     * @param op
+     * @return
+     */
+    protected static boolean isDocLitWrappedMinimal(OperationDescription op){
+        if (isDocLitWrapped(op)) {
+           ServiceDescription serviceDesc = op.getEndpointInterfaceDescription().getEndpointDescription().getServiceDescription();
+           MarshalServiceRuntimeDescription marshalDesc = 
+               MarshalServiceRuntimeDescriptionFactory.get(serviceDesc);
+           String requestWrapper = marshalDesc.getRequestWrapperClassName(op);
+           if (!exists(requestWrapper)) {
+               // TODO DEBUG
+               return true;
+           }
+           
+           String responseWrapper = marshalDesc.getRequestWrapperClassName(op);
+           if (!exists(responseWrapper)) {
+               // TODO DEBUG
+               return true;
+           }
+           // TODO Do the same for the fault beans
+        }
+        return false;
+    }
+    private static boolean exists(String className) {
+        if (className == null || className.length() == 0) {
+            return false;
+        }
+        // TODO try and load the class
+        return true;
     }
 }

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java?view=auto&rev=509789
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java Tue Feb 20 14:47:28 2007
@@ -0,0 +1,468 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.marshaller.impl.alt;
+
+import java.util.List;
+import java.util.TreeSet;
+
+import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
+import org.apache.axis2.jaxws.description.OperationDescription;
+import org.apache.axis2.jaxws.description.ParameterDescription;
+import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
+import org.apache.axis2.jaxws.message.Message;
+import org.apache.axis2.jaxws.message.Protocol;
+import org.apache.axis2.jaxws.message.factory.MessageFactory;
+import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The Doc/Lit Wrapped Minimal Marshaller is used when
+ *   1) The web service is Doc/Lit Wrapped, and
+ *   2) The wrapper and fault bean objects are missing (hence the term 'Minimal')
+ *   
+ * TODO
+ * This class was copied from RPC/LIT and is currently "UNDER DEVELOPMENT"
+ *
+ */
+public class DocLitWrappedMinimalMethodMarshaller implements MethodMarshaller {
+
+    private static Log log = LogFactory.getLog(DocLitWrappedMinimalMethodMarshaller.class);
+    
+    public DocLitWrappedMinimalMethodMarshaller() {
+        super();
+    }
+
+    public Message marshalRequest(Object[] signatureArguments, OperationDescription operationDesc) throws WebServiceException {
+        
+        EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription();
+        EndpointDescription endpointDesc = ed.getEndpointDescription();
+        Protocol protocol = null;
+        try {
+            protocol = Protocol.getProtocolForBinding(endpointDesc.getClientBindingID()); 
+        } catch (WebServiceException e) {
+            // TODO better handling than this?
+            e.printStackTrace();
+        }
+        
+        // Note all exceptions are caught and rethrown with a WebServiceException
+        try {
+            
+            // Sample RPC message
+            // ..
+            // <soapenv:body>
+            //    <m:op xmlns:m="urn://api">
+            //       <param xsi:type="data:foo" >...</param>
+            //    </m:op>
+            // </soapenv:body>
+            //
+            // Important points.
+            //   1) RPC has an operation element under the body.  This is the name of the
+            //      wsdl operation.
+            //   2) The data blocks are located underneath the operation element.  (In doc/lit
+            //      the data elements are underneath the body.
+            //   3) The name of the data blocks (param) are defined by the wsdl:part not the
+            //      schema.  Note that the param is unqualified...per WS-I BP.
+            //   4) The type of the data block (data:foo) is defined by schema (thus there is 
+            //      JAXB type rendering.  Since we are using JAXB to marshal the data, 
+            //      we always generate an xsi:type attribute.  This is an implemenation detail
+            //      and is not defined by any spec.
+            
+            
+            // Get the operation information
+            ParameterDescription[] pds =operationDesc.getParameterDescriptions();
+            MarshalServiceRuntimeDescription marshalDesc = MethodMarshallerUtils.getMarshalDesc(endpointDesc);
+            TreeSet<String> packages = marshalDesc.getPackages();
+            
+            // TODO This needs more work.  We need to check inside holders of input params.  We also
+            // may want to exclude header params from this check
+            //Validate input parameters for operation and make sure no input parameters are null.
+            //As per JAXWS Specification section 3.6.2.3 if a null value is passes as an argument 
+            //to a method then an implementation MUST throw WebServiceException.
+            if(pds.length > 0){
+            	if(signatureArguments == null){
+            		throw ExceptionFactory.makeWebServiceException(Messages.getMessage("NullParamErr1", "Input", operationDesc.getJavaMethodName(), "rpc/lit"));
+            	}
+            	if(signatureArguments !=null){
+            		for(Object argument:signatureArguments){
+            			if(argument == null){
+                            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("NullParamErr1", "Input", operationDesc.getJavaMethodName(), "rpc/lit"));
+            			}
+            		}
+            	}
+            }
+            
+            // Create the message 
+            MessageFactory mf = (MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);
+            Message m = mf.create(protocol);
+            
+            // Indicate the style and operation element name.  This triggers the message to
+            // put the data blocks underneath the operation element
+            m.setStyle(Style.RPC);
+            m.setOperationElement(getRPCOperationQName(operationDesc));
+            
+            // The input object represent the signature arguments.
+            // Signature arguments are both holders and non-holders
+            // Convert the signature into a list of JAXB objects for marshalling
+            List<PDElement> pdeList = 
+                MethodMarshallerUtils.getPDElements(marshalDesc,
+                        pds,
+                        signatureArguments,
+                        true,  // input
+                        false, true); // use partName since this is rpc/lit
+                        
+            
+            // Put values onto the message
+            MethodMarshallerUtils.toMessage(pdeList, m, packages, true);
+            
+            return m;
+        } catch(Exception e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+    
+    public Object[] demarshalRequest(Message message, OperationDescription operationDesc)
+        throws WebServiceException {
+        
+        EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription();
+        EndpointDescription endpointDesc = ed.getEndpointDescription();
+        
+        // Note all exceptions are caught and rethrown with a WebServiceException
+        try {
+            // Sample RPC message
+            // ..
+            // <soapenv:body>
+            //    <m:op xmlns:m="urn://api">
+            //       <param xsi:type="data:foo" >...</param>
+            //    </m:op>
+            // </soapenv:body>
+            //
+            // Important points.
+            //   1) RPC has an operation element under the body.  This is the name of the
+            //      wsdl operation.
+            //   2) The data blocks are located underneath the operation element.  (In doc/lit
+            //      the data elements are underneath the body.
+            //   3) The name of the data blocks (param) are defined by the wsdl:part not the
+            //      schema.  Note that it is unqualified per WSI-BP
+            //   4) The type of the data block (data:foo) is defined by schema (thus there is 
+            //      JAXB type rendering.  
+            //   5) We always send an xsi:type, but other vendor's may not.
+            // Get the operation information
+            ParameterDescription[] pds =operationDesc.getParameterDescriptions();
+            MarshalServiceRuntimeDescription marshalDesc = MethodMarshallerUtils.getMarshalDesc(endpointDesc);
+            TreeSet<String> packages = marshalDesc.getPackages();
+            
+            // Indicate that the style is RPC.  This is important so that the message understands
+            // that the data blocks are underneath the operation element
+            message.setStyle(Style.RPC);
+            
+            // Unmarshal the ParamValues from the Message
+            List<PDElement> pvList = MethodMarshallerUtils.getPDElements(pds, message, packages, true);
+            
+            // Build the signature arguments
+            Object[] sigArguments = MethodMarshallerUtils.createRequestSignatureArgs(pds, pvList);
+            
+            
+            // TODO This needs more work.  We need to check inside holders of input params.  We also
+            // may want to exclude header params from this check
+            //Validate input parameters for operation and make sure no input parameters are null.
+            //As per JAXWS Specification section 3.6.2.3 if a null value is passes as an argument 
+            //to a method then an implementation MUST throw WebServiceException.
+            if(sigArguments !=null){
+                for(Object argument:sigArguments){
+                    if(argument == null){
+                        throw ExceptionFactory.makeWebServiceException(Messages.getMessage("NullParamErr1", "Input", operationDesc.getJavaMethodName(), "rpc/lit"));
+
+                    }
+                }
+            }
+            return sigArguments;
+        } catch(Exception e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+   
+
+    public Message marshalResponse(Object returnObject, Object[] signatureArgs, 
+            OperationDescription operationDesc, Protocol protocol)
+            throws WebServiceException {
+        
+        
+        EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription();
+        EndpointDescription endpointDesc = ed.getEndpointDescription();
+        // We want to respond with the same protocol as the request,
+        // It the protocol is null, then use the Protocol defined by the binding
+        if (protocol == null) {
+            try {
+                protocol = Protocol.getProtocolForBinding(endpointDesc.getBindingType());
+            } catch (WebServiceException e) {
+                // TODO better handling than this?
+                e.printStackTrace();
+            }
+        }
+        
+        // Note all exceptions are caught and rethrown with a WebServiceException
+        try {
+            // Sample RPC message
+            // ..
+            // <soapenv:body>
+            //    <m:opResponse xmlns:m="urn://api">
+            //       <param xsi:type="data:foo" >...</param>
+            //    </m:op>
+            // </soapenv:body>
+            //
+            // Important points.
+            //   1) RPC has an operation element under the body.  This is the name of the
+            //      wsdl operation.
+            //   2) The data blocks are located underneath the operation element.  (In doc/lit
+            //      the data elements are underneath the body.
+            //   3) The name of the data blocks (param) are defined by the wsdl:part not the
+            //      schema.  Note that it is unqualified.
+            //   4) The type of the data block (data:foo) is defined by schema (thus there is 
+            //      JAXB type rendering.  Since we are using JAXB to marshal the data, 
+            //      we always generate an xsi:type attribute.  This is an implemenation detail
+            //      and is not defined by any spec.
+            
+            // Get the operation information
+            ParameterDescription[] pds =operationDesc.getParameterDescriptions();
+            MarshalServiceRuntimeDescription marshalDesc = MethodMarshallerUtils.getMarshalDesc(endpointDesc);
+            TreeSet<String> packages = marshalDesc.getPackages();
+            
+            // Create the message 
+            MessageFactory mf = (MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);
+            Message m = mf.create(protocol);
+            
+            // Indicate the style and operation element name.  This triggers the message to
+            // put the data blocks underneath the operation element
+            m.setStyle(Style.RPC);
+            
+            // TODO Is there an annotation for the operation element response ?
+            QName rpcOpQName = getRPCOperationQName(operationDesc);
+            String localPart = rpcOpQName.getLocalPart() + "Response";
+            QName responseOp = new QName(rpcOpQName.getNamespaceURI(), localPart, rpcOpQName.getPrefix());
+            m.setOperationElement(responseOp);
+            
+            // Put the return object onto the message
+            Class returnType = operationDesc.getResultActualType();
+            String returnNS = null;
+            String returnLocalPart = null;
+            if (operationDesc.isResultHeader()) {
+                returnNS = operationDesc.getResultTargetNamespace();
+                returnLocalPart = operationDesc.getResultName();
+            } else {
+                returnNS = "";  // According to WSI BP the body part is unqualified
+                returnLocalPart = operationDesc.getResultPartName();
+            }
+            
+            if (returnType != void.class) {
+                
+                // TODO should we allow null if the return is a header?
+                //Validate input parameters for operation and make sure no input parameters are null.
+                //As per JAXWS Specification section 3.6.2.3 if a null value is passes as an argument 
+                //to a method then an implementation MUST throw WebServiceException.
+                if(returnObject == null){
+                    throw ExceptionFactory.makeWebServiceException(Messages.getMessage("NullParamErr1", "Return", operationDesc.getJavaMethodName(), "rpc/lit"));
+
+                }
+                Element returnElement = null;
+                QName returnQName = new QName(returnNS, returnLocalPart);
+                if (marshalDesc.getAnnotationDesc(returnType).hasXmlRootElement()) {
+                    returnElement = new Element(returnObject, returnQName);
+                } else {
+                    returnElement = new Element(returnObject, returnQName, returnType);
+                }
+                MethodMarshallerUtils.toMessage(returnElement, 
+                        returnType, 
+                        marshalDesc, 
+                        m,
+                        true, // forceXSI since this is rpc/lit
+                        operationDesc.isResultHeader()); 
+            }
+            
+            // Convert the holder objects into a list of JAXB objects for marshalling
+            List<PDElement> pvList = 
+                MethodMarshallerUtils.getPDElements(marshalDesc,
+                        pds, 
+                        signatureArgs, 
+                        false,  // output
+                        false, true);   // use partName since this is rpc/lit
+
+            // TODO Should we check for null output body values?  Should we check for null output header values ?
+            // Put values onto the message
+            MethodMarshallerUtils.toMessage(pvList, m, packages, true);
+            
+            return m;
+        } catch(Exception e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    
+    public Object demarshalResponse(Message message, Object[] signatureArgs, OperationDescription operationDesc)
+          throws WebServiceException {
+        
+        EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription();
+        EndpointDescription endpointDesc = ed.getEndpointDescription();
+        
+        // Note all exceptions are caught and rethrown with a WebServiceException
+        try {
+            // Sample RPC message
+            // ..
+            // <soapenv:body>
+            //    <m:opResponse xmlns:m="urn://api">
+            //       <param xsi:type="data:foo" >...</param>
+            //    </m:op>
+            // </soapenv:body>
+            //
+            // Important points.
+            //   1) RPC has an operation element under the body.  This is the name of the
+            //      wsdl operation.
+            //   2) The data blocks are located underneath the operation element.  (In doc/lit
+            //      the data elements are underneath the body.
+            //   3) The name of the data blocks (param) are defined by the wsdl:part not the
+            //      schema.  Note that it is unqualified per WSI-BP
+            //   4) The type of the data block (data:foo) is defined by schema (thus there is 
+            //      JAXB type rendering.  
+            //   5) We always send an xsi:type, but other vendor's may not.
+            // Get the operation information
+            ParameterDescription[] pds =operationDesc.getParameterDescriptions();
+            MarshalServiceRuntimeDescription marshalDesc = MethodMarshallerUtils.getMarshalDesc(endpointDesc);
+            TreeSet<String> packages = marshalDesc.getPackages();
+            
+            // Indicate that the style is RPC.  This is important so that the message understands
+            // that the data blocks are underneath the operation element
+            message.setStyle(Style.RPC);
+            
+            // Get the return value.
+            Class returnType = operationDesc.getResultActualType();
+            Object returnValue = null;
+            if (returnType != void.class) {
+                // If the webresult is in the header, we need the name of the header so that we can find it.
+                Element returnElement = null;
+                if (operationDesc.isResultHeader()) {
+                    returnElement = MethodMarshallerUtils.getReturnElement(packages, message, returnType, true,
+                            operationDesc.getResultTargetNamespace(), operationDesc.getResultPartName());
+                } else {
+                    returnElement = MethodMarshallerUtils.getReturnElement(packages, message, returnType, false, null, null);
+                }
+                returnValue = returnElement.getTypeValue();
+                // TODO should we allow null if the return is a header?
+                //Validate input parameters for operation and make sure no input parameters are null.
+                //As per JAXWS Specification section 3.6.2.3 if a null value is passes as an argument 
+                //to a method then an implementation MUST throw WebServiceException.
+                if (returnValue == null){
+                    throw ExceptionFactory.makeWebServiceException(Messages.getMessage("NullParamErr1", "Return", operationDesc.getJavaMethodName(), "rpc/lit"));
+                }
+            }
+            
+            // Unmarshall the ParamValues from the Message
+            List<PDElement> pvList = MethodMarshallerUtils.getPDElements(pds, message, packages, false);
+            
+            // TODO Should we check for null output body values?  Should we check for null output header values ?
+            
+            // Populate the response Holders
+            MethodMarshallerUtils.updateResponseSignatureArgs(pds, pvList, signatureArgs);
+            
+            return returnValue;
+        } catch(Exception e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    public Message marshalFaultResponse(Throwable throwable, 
+            OperationDescription operationDesc, Protocol protocol) throws WebServiceException {
+        
+        EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription();
+        EndpointDescription endpointDesc = ed.getEndpointDescription();
+        MarshalServiceRuntimeDescription marshalDesc = MethodMarshallerUtils.getMarshalDesc(endpointDesc);
+        TreeSet<String> packages = marshalDesc.getPackages();
+        
+        // We want to respond with the same protocol as the request,
+        // It the protocol is null, then use the Protocol defined by the binding
+        if (protocol == null) {
+            try {
+                protocol = Protocol.getProtocolForBinding(endpointDesc.getBindingType());
+            } catch (WebServiceException e) {
+                // TODO better handling than this?
+                e.printStackTrace();
+            }
+        }
+        
+        // Note all exceptions are caught and rethrown with a WebServiceException
+        try {
+            // Create the message 
+            MessageFactory mf = (MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);
+            Message m = mf.create(protocol);
+            
+            // Put the fault onto the message
+            MethodMarshallerUtils.marshalFaultResponse(throwable, 
+                    marshalDesc,
+                    operationDesc, 
+                    m, 
+                    true);  // isRPC=true
+            return m;
+        } catch(Exception e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    public Throwable demarshalFaultResponse(Message message, OperationDescription operationDesc) throws WebServiceException {
+        
+        EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription();
+        EndpointDescription endpointDesc = ed.getEndpointDescription();
+        MarshalServiceRuntimeDescription marshalDesc = MethodMarshallerUtils.getMarshalDesc(endpointDesc);
+        
+        // Note all exceptions are caught and rethrown with a WebServiceException
+        try {
+            Throwable t = MethodMarshallerUtils.demarshalFaultResponse(operationDesc, marshalDesc, message,  true); 
+            return t;
+        } catch(Exception e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+    
+    /**
+     * @param opDesc
+     * @return qualified qname to use in the rpc message to represent the operation
+     * (per WSI BP)
+     */
+    private static QName getRPCOperationQName(OperationDescription opDesc) {
+        QName qName = opDesc.getName();
+        
+        String localPart = qName.getLocalPart();
+        String uri = (qName.getNamespaceURI().length() == 0) ? 
+                      opDesc.getEndpointInterfaceDescription().getTargetNamespace() :
+                      qName.getNamespaceURI();
+        String prefix = "rpcOp";  // Prefer using an actual prefix
+                
+        
+        qName = new QName(uri, localPart, prefix);
+        return qName;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/greeterTypes.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/greeterTypes.xsd?view=auto&rev=509789
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/greeterTypes.xsd (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/greeterTypes.xsd Tue Feb 20 14:47:28 2007
@@ -0,0 +1,10 @@
+<schema targetNamespace="http://apache.org/axis2/jaxws/sample/dlwmin/types" 
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+     <complexType name="TestBean">
+       <sequence>
+         <element name="data1" type="xsd:string"/>
+         <element name="data2" type="xsd:int"/>
+       </sequence>
+     </complexType>
+</schema>
\ No newline at end of file

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=509789&r1=509788&r2=509789
==============================================================================
--- 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 Tue Feb 20 14:47:28 2007
@@ -64,6 +64,7 @@
 import org.apache.axis2.jaxws.sample.AddNumbersTests;
 import org.apache.axis2.jaxws.sample.AddressBookTests;
 import org.apache.axis2.jaxws.sample.BareTests;
+import org.apache.axis2.jaxws.sample.DLWMinTests;
 import org.apache.axis2.jaxws.sample.FaultsServiceTests;
 import org.apache.axis2.jaxws.sample.FaultyWebServiceTests;
 import org.apache.axis2.jaxws.sample.MtomSampleTests;
@@ -143,6 +144,7 @@
         suite.addTestSuite(NonWrapTests.class);
         suite.addTestSuite(WSGenTests.class);
         suite.addTestSuite(WrapTests.class);
+        suite.addTestSuite(DLWMinTests.class);
         suite.addTestSuite(NonAnonymousComplexTypeTests.class);
         suite.addTestSuite(AddNumbersTests.class);
         // TODO: This test intermittently fails on Linux and with trace enabled.

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/DLWMinTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/DLWMinTests.java?view=auto&rev=509789
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/DLWMinTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/DLWMinTests.java Tue Feb 20 14:47:28 2007
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006 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.sample;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+
+import org.apache.axis2.jaxws.sample.dlwmin.sei.Greeter;
+
+import junit.framework.TestCase;
+
+public class DLWMinTests extends TestCase {
+
+    private static final String NAMESPACE = "http://apache.org/axis2/jaxws/sample/dlwmin";
+    private static final QName QNAME_SERVICE = new QName(
+            NAMESPACE, "GreeterService");
+    private static final QName QNAME_PORT = new QName(
+            NAMESPACE, "GreeterPort");
+    private static final String URL_ENDPOINT = "http://localhost:8080/axis2/services/GreeterService";
+
+    /**
+     * Test that we can call the simple greetMe method 
+     * with style doc/lit wrapped without the presence of wrapper classes.
+     */
+    public void testGreetMe() {
+        Service service = Service.create(QNAME_SERVICE);
+        Greeter proxy = service.getPort(QNAME_PORT, Greeter.class);
+        BindingProvider p = (BindingProvider) proxy;
+        p.getRequestContext().put(
+                BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
+        p.getRequestContext().put(
+                BindingProvider.SOAPACTION_URI_PROPERTY, "greetMe");
+        p.getRequestContext().put(
+                BindingProvider.ENDPOINT_ADDRESS_PROPERTY, URL_ENDPOINT);
+
+        String me = "Scheu";
+        String response = proxy.greetMe(me);
+        assertTrue("Hello Scheu".equals(response));
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/GreeterImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/GreeterImpl.java?view=auto&rev=509789
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/GreeterImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/GreeterImpl.java Tue Feb 20 14:47:28 2007
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.dlwmin;
+
+import org.apache.axis2.jaxws.sample.dlwmin.sei.Greeter;
+import javax.jws.WebService;
+
+@WebService(endpointInterface = "org.apache.axis2.jaxws.sample.dlwmin.sei.Greeter",
+        targetNamespace = "http://apache.org/axis2/jaxws/sample/dlwmin")
+public class GreeterImpl implements Greeter {
+
+    public String greetMe(String me) {
+        return "Hello " + me;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/greeter.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/greeter.wsdl?view=auto&rev=509789
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/greeter.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/greeter.wsdl Tue Feb 20 14:47:28 2007
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:tns="http://apache.org/axis2/jaxws/sample/dlwmin"
+    xmlns:x1="http://apache.org/axis2/jaxws/sample/dlwmin/params"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://apache.org/axis2/jaxws/sample/dlwmin" name="HelloWorld">
+    <wsdl:types>
+        <schema targetNamespace="http://apache.org/axis2/jaxws/sample/dlwmin/params" 
+            xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+            <import namespace="http://apache.org/axis2/jaxws/sample/dlwmin/types"
+                    schemaLocation="greeterTypes.xsd" />
+                    
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            
+            
+        </schema>
+    </wsdl:types>
+
+   
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMeResponse" name="out"/>
+    </wsdl:message>
+
+        
+    <wsdl:portType name="Greeter">
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+     
+    </wsdl:portType>
+    
+
+    <wsdl:binding name="GreeterSOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="greetMe" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+    </wsdl:binding>
+  
+    <wsdl:service name="GreeterService">
+        <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort">
+            <soap:address location="http://localhost:8080/axis2/services/GreeterService"/>
+        </wsdl:port>
+    </wsdl:service>
+   
+    
+</wsdl:definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/greeterTypes.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/greeterTypes.xsd?view=auto&rev=509789
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/greeterTypes.xsd (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/greeterTypes.xsd Tue Feb 20 14:47:28 2007
@@ -0,0 +1,10 @@
+<schema targetNamespace="http://apache.org/axis2/jaxws/sample/dlwmin/types" 
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+     <complexType name="TestBean">
+       <sequence>
+         <element name="data1" type="xsd:string"/>
+         <element name="data2" type="xsd:int"/>
+       </sequence>
+     </complexType>
+</schema>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/services.xml?view=auto&rev=509789
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/META-INF/services.xml Tue Feb 20 14:47:28 2007
@@ -0,0 +1,11 @@
+<serviceGroup>
+ <service name="GreeterService">
+  <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.sample.dlwmin.GreeterImpl</parameter>
+  <operation name="greetMe" 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/sample/dlwmin/sei/Greeter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/sei/Greeter.java?view=auto&rev=509789
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/sei/Greeter.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/dlwmin/sei/Greeter.java Tue Feb 20 14:47:28 2007
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.dlwmin.sei;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://apache.org/axis2/jaxws/sample/dlwmin", name = "Greeter")
+
+public interface Greeter {
+    @WebResult(targetNamespace = "http://apache.org/axis2/jaxws/sample/dlwmin/params", name = "responseType")
+    @WebMethod(operationName = "greetMe", action="greetMe")
+    public java.lang.String greetMe(
+        @WebParam(targetNamespace = "http://apache.org/axis2/jaxws/sample/dlwmin/params", name = "requestType")
+        java.lang.String requestType
+    );
+}



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