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 sc...@apache.org on 2007/07/16 23:12:02 UTC

svn commit: r556738 - in /webservices/axis2/trunk/java/modules/metadata: src/org/apache/axis2/jaxws/description/impl/ src/org/apache/axis2/jaxws/i18n/ test/org/apache/axis2/jaxws/description/

Author: scheu
Date: Mon Jul 16 14:12:00 2007
New Revision: 556738

URL: http://svn.apache.org/viewvc?view=rev&rev=556738
Log:
AXIS2-2606
Contributor:Roy Wood
Issue an error message if an attempt is made to do @SOAPBinding.use=ENCODED

Modified:
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties
    webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?view=diff&rev=556738&r1=556737&r2=556738
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Mon Jul 16 14:12:00 2007
@@ -21,36 +21,6 @@
 import static org.apache.axis2.jaxws.description.builder.MDQConstants.RETURN_TYPE_FUTURE;
 import static org.apache.axis2.jaxws.description.builder.MDQConstants.RETURN_TYPE_RESPONSE;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.ConnectException;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.jws.HandlerChain;
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.namespace.QName;
-import javax.xml.ws.soap.SOAPBinding;
-
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisService;
@@ -74,6 +44,33 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javax.jws.HandlerChain;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.SOAPBinding;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.ConnectException;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 
 /** @see ../ServiceDescription */
 class ServiceDescriptionImpl
@@ -817,6 +814,7 @@
 
                 } else { //this is an implicit SEI (i.e. impl w/out endpointInterface
 
+                    
                     checkImplicitSEIAgainstWSDL();
                     //	TODO:	Call ValidateWebMethodAnnots()
                     //			- this method will check that all methods are public - ???
@@ -829,6 +827,16 @@
                                 + composite.getClassName());
             }
 
+            // Verify that the SOAPBinding annotations are supported.
+            //REVIEW: The assumption here is that SOAPBinding annotation can be place on an impl. class
+            //        (implicit SEI) or a WebServiceProvider
+            if (composite.getSoapBindingAnnot() != null) {
+                if (composite.getSoapBindingAnnot().use() == javax.jws.soap.SOAPBinding.Use.ENCODED) {
+                    throw ExceptionFactory.makeWebServiceException("Validation error: Unsupported SOAPBinding annotation value. The ENCODED setting is not supported for SOAPBinding.Use. Implementation class: " 
+                                +composite.getClassName());  
+                }
+            }
+            
             //TODO: don't think this is necessary
             checkMethodsAgainstWSDL();
         }
@@ -1253,6 +1261,13 @@
                             + "; Invalid endpointInterface value: " +
                             seic.getWebServiceAnnot().endpointInterface());
         }
+        // Verify that the SOAPBinding annotations are supported.
+        if (seic.getSoapBindingAnnot() != null) {
+        if (seic.getSoapBindingAnnot().use() == javax.jws.soap.SOAPBinding.Use.ENCODED) {
+               throw ExceptionFactory.makeWebServiceException("Validation error: Unsupported SOAPBinding annotation value. The ENCODED setting is not supported for SOAPBinding.Use. Implementation class: " 
+                        +seic.getClassName());  
+        }
+       }
 
         checkSEIAgainstWSDL();
 

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=556738&r1=556737&r2=556738
==============================================================================
--- 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 Mon Jul 16 14:12:00 2007
@@ -179,4 +179,6 @@
 handlerChainNS=The @HandlerChain configuration file {0} in the class {1} could not be loaded.
 hcConfigLoadFail=The @HandlerChain configuration file {0} in the class {1} could not be loaded due to the following error: {2}
 serverSideAsync=The server-side SEI {0} contains the asynchronous method {1}. Asynchronous methods are not allowed for server-side artifacts.
-onewayAsync=The async listener property was set.  A one way invocation cannot be performed using an async response channel.
\ No newline at end of file
+onewayAsync=The async listener property was set.  A one way invocation cannot be performed using an async response channel.
+soapBindingUseEncoded=The SEI {0} contains method {1} with an unsupported SOAPBinding annotation value. SOAPBinding.Use field cannot be set to ENCODED.
+soapBindingStyle=The SEI {0} contains method {1} with annotation SOAPBinding.Style set to RPC.

Modified: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java?view=diff&rev=556738&r1=556737&r2=556738
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java Mon Jul 16 14:12:00 2007
@@ -345,14 +345,25 @@
     }
 
     public void testSOAPBindingDocEncBare() {
-        EndpointInterfaceDescription testEndpointInterfaceDesc =
+        //verify that we throw an exception when SOAPBinding.Use == ENCODED is specified
+        try {
+            EndpointInterfaceDescription testEndpointInterfaceDesc =
                 getEndpointInterfaceDesc(SOAPBindingDocEncBareTestImpl.class);
+            fail("Should have caused exception");
+        } catch (Exception e) {
+            // Expected path, SOAPBinding.Use == ENCODED is not supported
+        }
+    }
+    
+    public void testSOAPBindingDocLitBare() {
+        EndpointInterfaceDescription testEndpointInterfaceDesc =
+                getEndpointInterfaceDesc(SOAPBindingDocLitBareTestImpl.class);
 
         assertNotNull(
                 ((EndpointInterfaceDescriptionJava)testEndpointInterfaceDesc).getAnnoSoapBinding());
         assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT,
                      testEndpointInterfaceDesc.getSoapBindingStyle());
-        assertEquals(javax.jws.soap.SOAPBinding.Use.ENCODED,
+        assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL,
                      testEndpointInterfaceDesc.getSoapBindingUse());
         assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE,
                      testEndpointInterfaceDesc.getSoapBindingParameterStyle());
@@ -361,13 +372,13 @@
     public void testSOAPBindingMethodAnnotation() {
         // Verify that an impl without the method annotation uses the settings from the type
         EndpointInterfaceDescription testEndpointInterfaceDesc =
-                getEndpointInterfaceDesc(SOAPBindingDocEncBareTestImpl.class);
+                getEndpointInterfaceDesc(SOAPBindingDocLitBareTestImpl.class);
 
         assertNotNull(
                 ((EndpointInterfaceDescriptionJava)testEndpointInterfaceDesc).getAnnoSoapBinding());
         assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT,
                      testEndpointInterfaceDesc.getSoapBindingStyle());
-        assertEquals(javax.jws.soap.SOAPBinding.Use.ENCODED,
+        assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL,
                      testEndpointInterfaceDesc.getSoapBindingUse());
         assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE,
                      testEndpointInterfaceDesc.getSoapBindingParameterStyle());
@@ -378,7 +389,7 @@
         assertNull(((OperationDescriptionJava)operationDesc).getAnnoSoapBinding());
         assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT,
                      operationDesc.getSoapBindingStyle());
-        assertEquals(javax.jws.soap.SOAPBinding.Use.ENCODED, operationDesc.getSoapBindingUse());
+        assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL, operationDesc.getSoapBindingUse());
         assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE,
                      operationDesc.getSoapBindingParameterStyle());
 
@@ -400,7 +411,7 @@
         assertNotNull(((OperationDescriptionJava)operationDesc).getAnnoSoapBinding());
         assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT,
                      operationDesc.getSoapBindingStyle());
-        assertEquals(javax.jws.soap.SOAPBinding.Use.ENCODED, operationDesc.getSoapBindingUse());
+        assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL, operationDesc.getSoapBindingUse());
         assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE,
                      operationDesc.getSoapBindingParameterStyle());
     }
@@ -1178,18 +1189,32 @@
     }
 }
 // ============================================================================
-// SOAPBindingDocEncBareTestImpl service implementation class
+// SOAPBindingDocLiBareTestImpl service implementation class
 // Note that Style should default
 // ============================================================================
 
 @WebService()
-@SOAPBinding(use = javax.jws.soap.SOAPBinding.Use.ENCODED,
+@SOAPBinding(use = javax.jws.soap.SOAPBinding.Use.LITERAL,
              parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
-class SOAPBindingDocEncBareTestImpl {
+class SOAPBindingDocLitBareTestImpl {
     public String echoString(String s) {
         return s;
     }
 }
+
+//============================================================================
+//SOAPBindingDocEncBareTestImpl service implementation class
+//Note that Style should default
+//============================================================================
+
+@WebService()
+@SOAPBinding(use = javax.jws.soap.SOAPBinding.Use.ENCODED,
+          parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
+class SOAPBindingDocEncBareTestImpl {
+ public String echoString(String s) {
+     return s;
+ }
+}
 // ============================================================================
 // SOAPBindingDefaultMethodTest service implementation class
 // Note that style will default to DOCUMENT based on Type annotation
@@ -1197,7 +1222,7 @@
 
 @WebService()
 class SOAPBindingDefaultMethodTestImpl {
-    @SOAPBinding(use = javax.jws.soap.SOAPBinding.Use.ENCODED,
+    @SOAPBinding(use = javax.jws.soap.SOAPBinding.Use.LITERAL,
                  parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
     public String echoString(String s) {
         return s;



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