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 ng...@apache.org on 2006/11/08 05:07:30 UTC

svn commit: r472381 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: i18n/resource.properties spi/ServiceDelegate.java

Author: ngallardo
Date: Tue Nov  7 20:07:29 2006
New Revision: 472381

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

Checks to make sure we can only create valid Dispatch types.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/i18n/resource.properties
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/i18n/resource.properties?view=diff&rev=472381&r1=472380&r2=472381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/i18n/resource.properties Tue Nov  7 20:07:29 2006
@@ -112,6 +112,7 @@
 dispatchNullParamMessageMode=The parameter cannot be a null value for a Dispatch invocation using MESSAGE mode.
 dispatchNullParamHttpBinding=The parameter cannot be a null value for a Dispatch invocation using the XML/HTTP binding.
 dispatchInvalidParam=The parameter for the Dispatch invocation was not valid.
+dispatchInvalidType=Unsupported Dispatch Type, Dispatch can only be of type java.lang.String, javax.xml.transform.Source, javax.xml.soap.SOAPMessage, javax.xml.soap.SOAPEnvelope.
 prepareRequestFail=An error occurred when the system was preparing the request message.
 validateUserName=Error: A value must be specified when setting the javax.xml.ws.security.auth.username property.
 validatePassword=Error: A value must be specified when setting the javax.xml.ws.security.auth.password property.
@@ -127,3 +128,6 @@
 WebServiceContextInjectionImplErr6=injection can happen using method if method name starts with \"set\" returns a void and only has one parameter and the type of this parameter must be compatible with resource.
 ResourceInjectionFactoryErr1=Unknown Resource Type, Currently only Resource of Type javax.xml.ws.WebServiceContext can be injected.
 EndpointLifecycleManagerImplErr1=Failed to create EndpointLifecycleManager, Endpoint Instance cannot be null.
+ClassUtilsErr1=Unable to get class loader.
+ClassUtilsErr2={0} + " does not appear to be a valid package (Unsupported encoding)"
+ClassUtilsErr3="IOException was thrown when trying to get all resources for {0}"

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=472381&r1=472380&r2=472381
==============================================================================
--- 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 Tue Nov  7 20:07:29 2006
@@ -27,6 +27,9 @@
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
@@ -142,7 +145,9 @@
     	if(qname == null){
     		throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail0"));
     	}
-    	
+    	if(!isValidDispatchType(clazz)){
+    		throw ExceptionFactory.makeWebServiceException(Messages.getMessage("dispatchInvalidType"));
+    	}
     	if(!isPortValid(qname)){
     		throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createDispatchFail1", qname.toString()));
     	}
@@ -414,5 +419,11 @@
 	        	//instantiate http binding implementation here and call setBinding in BindingProvider
 	        }
         }
+    }
+    
+    private boolean isValidDispatchType(Class clazz) {
+    	return clazz != null && (clazz == String.class || 
+    			clazz == Source.class || 
+    			clazz == SOAPMessage.class);
     }
 }



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