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

svn commit: r643958 - in /webservices/axis2/trunk/java/modules: jaxws-integration/test/org/apache/axis2/jaxws/provider/ jaxws/src/org/apache/axis2/jaxws/spi/ metadata/src/org/apache/axis2/jaxws/i18n/

Author: woodroy
Date: Wed Apr  2 09:27:07 2008
New Revision: 643958

URL: http://svn.apache.org/viewvc?rev=643958&view=rev
Log:
AXIS2-3695
Contributor: Roy Wood

Preclude new dispatch instances where type is SOAP and mode is payload

Modified:
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties

Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java?rev=643958&r1=643957&r2=643958&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java Wed Apr  2 09:27:07 2008
@@ -407,6 +407,23 @@
         
     }
     /**
+     * This is a negative test to insure that we don't allow creation of a dispatch with
+     * type Soap using Payload mode
+     */
+    public void testInvalidTypeWithMode(){
+        try{       
+            Service svc = Service.create(serviceName);
+            svc.addPort(portName, null, endpointUrl);
+            Dispatch<SOAPMessage> dispatch = 
+            	svc.createDispatch(portName, SOAPMessage.class, Service.Mode.PAYLOAD);
+            fail("Did not catch exception for invalid Dispatch with Payload Mode");
+            
+        }catch(Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    /**
      * @return
      * @throws Exception
      */

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?rev=643958&r1=643957&r2=643958&view=diff
==============================================================================
--- 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 Wed Apr  2 09:27:07 2008
@@ -270,11 +270,17 @@
             throw ExceptionFactory
                     .makeWebServiceException(Messages.getMessage("dispatchNoEndpointReference"));
         }
+        
         if (!isValidDispatchType(type)) {
             throw ExceptionFactory
                     .makeWebServiceException(Messages.getMessage("dispatchInvalidType"));
         }
         
+        if (!isValidDispatchTypeWithMode(type, mode)) {
+            throw ExceptionFactory
+                    .makeWebServiceException(Messages.getMessage("dispatchInvalidTypeWithMode"));
+        }
+        
         org.apache.axis2.addressing.EndpointReference axis2EPR =
             EndpointReferenceUtils.createAxis2EndpointReference("");
         String addressingNamespace = null;
@@ -369,11 +375,17 @@
             throw ExceptionFactory
                     .makeWebServiceException(Messages.getMessage("createDispatchFail0"));
         }
+        
         if (!isValidDispatchType(type)) {
             throw ExceptionFactory
                     .makeWebServiceException(Messages.getMessage("dispatchInvalidType"));
         }
 
+        if (!isValidDispatchTypeWithMode(type, mode)) {
+            throw ExceptionFactory
+                    .makeWebServiceException(Messages.getMessage("dispatchInvalidTypeWithMode"));
+        }
+
         EndpointDescription endpointDesc =
                 DescriptionFactory.updateEndpoint(serviceDescription, 
                 								  null, 
@@ -745,6 +757,16 @@
                 clazz == Source.class ||
                 clazz == DataSource.class ||
                 clazz == SOAPMessage.class);
+    }
+
+    private boolean isValidDispatchTypeWithMode(Class clazz, Mode mode) {
+
+    	if (clazz != null && !(clazz == SOAPMessage.class && mode.equals(Service.Mode.PAYLOAD))) {
+    			return true;
+    	} else {
+    		return false;
+    	}
+  
     }
 
     /** @return ClassLoader */

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?rev=643958&r1=643957&r2=643958&view=diff
==============================================================================
--- 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 Wed Apr  2 09:27:07 2008
@@ -381,4 +381,5 @@
 missingInvocationController=An invocation controller object was not found.
 unknownClassType=Unknown class type {0}
 axisEndpointReferenceFactoryErr=Cannot create an endpoint reference because the service name is null, and the port name is set to {0}
-axisEndpointReferenceFactoryErr2=Cannot create an endpoint reference because the address, service name, and/or port name are null.
\ No newline at end of file
+axisEndpointReferenceFactoryErr2=Cannot create an endpoint reference because the address, service name, and/or port name are null.
+dispatchInvalidTypeWithMode=Unsupported Dispatch Type: Dispatch type javax.xml.soap.SOAPMessage cannot be used with messages in Payload mode.
\ No newline at end of file



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