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 nt...@apache.org on 2007/01/09 23:59:35 UTC

svn commit: r494640 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/ jaxws/test/org/apache/axis2/jaxws/proxy/ metadata/src/org/apache/axis2/jaxws/i18n/

Author: nthaker
Date: Tue Jan  9 14:59:34 2007
New Revision: 494640

URL: http://svn.apache.org/viewvc?view=rev&rev=494640
Log:
AXIS2-1958
Contributor - Nikhil Thaker

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java?view=diff&rev=494640&r1=494639&r2=494640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java Tue Jan  9 14:59:34 2007
@@ -30,6 +30,7 @@
 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.MessageException;
@@ -86,6 +87,22 @@
             // Get the operation information
             ParameterDescription[] pds =operationDesc.getParameterDescriptions();
             Set<String> packages = endpointDesc.getPackages();
+            
+            //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("RPCLitMethodMarshallerErr1"));
+            	}
+            	if(signatureArguments !=null){
+            		for(Object argument:signatureArguments){
+            			if(argument == null){
+            				throw ExceptionFactory.makeWebServiceException(Messages.getMessage("RPCLitMethodMarshallerErr1"));
+            			}
+            		}
+            	}
+            }
             
             // Create the message 
             MessageFactory mf = (MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java?view=diff&rev=494640&r1=494639&r2=494640
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java Tue Jan  9 14:59:34 2007
@@ -31,6 +31,7 @@
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
 
 import junit.framework.TestCase;
 import org.apache.axis2.jaxws.proxy.rpclit.RPCLitImpl;
@@ -91,6 +92,22 @@
         }catch(Exception e){ 
             e.printStackTrace(); 
             fail("Exception received" + e);
+        }
+    }
+    
+    /**
+     * Simple test that ensures that we can echo a string to an rpc/lit web service
+     */
+    public void testForNull() throws Exception {
+        try{ 
+            RPCLit proxy = getProxy();
+            String request = null;
+           
+            String response = proxy.testSimple(request);
+            fail("RPC/LIT should throw webserviceException when operation is invoked with null input parameter");
+        }catch(Exception e){ 
+            assertTrue(e instanceof WebServiceException);
+            System.out.println(e.getMessage());
         }
     }
     

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties?view=diff&rev=494640&r1=494639&r2=494640
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties Tue Jan  9 14:59:34 2007
@@ -141,3 +141,4 @@
 dispatchBadDOMSource=An invalid DOMSource was encountered during Dispatch.  Please use a DOMSource that contains a Node.
 convertProblem=An internal error occurred during JAX-WS marshalling. An object of type {0} cannot be converted into the destination type of {1}
 invalidPropValue=The value of property {0} was invalid.  {1} does not match expected type {2}.
+RPCLitMethodMarshallerErr1=Input argument for Operation cannot be null for RPC/LIT messages.



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