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 ba...@apache.org on 2006/09/29 17:40:07 UTC

svn commit: r451327 - in /webservices/axis2/trunk/java/modules/jaxws: src/javax/xml/ws/ src/org/apache/axis2/jaxws/description/ test/org/apache/axis2/jaxws/description/

Author: barrettj
Date: Fri Sep 29 08:40:07 2006
New Revision: 451327

URL: http://svn.apache.org/viewvc?view=rev&rev=451327
Log:
Add default annotation processing for ServiceMode, BindingType, SOAPBinding on type and method, Oneway, RequestWrapper, ResponseWrapper.
Also fix incorrect annotation definitions for javax.xml.ws RequestWrapper and ResponseWrapper.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/javax/xml/ws/RequestWrapper.java
    webservices/axis2/trunk/java/modules/jaxws/src/javax/xml/ws/ResponseWrapper.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationProviderImplDescriptionTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/javax/xml/ws/RequestWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/javax/xml/ws/RequestWrapper.java?view=diff&rev=451327&r1=451326&r2=451327
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/javax/xml/ws/RequestWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/javax/xml/ws/RequestWrapper.java Fri Sep 29 08:40:07 2006
@@ -24,9 +24,7 @@
 @Retention(RetentionPolicy.RUNTIME)
 public @interface RequestWrapper {
 
-    public String localName();
-
-    public String targetNamespace();
-
-    public String className();
+    public String localName() default "";
+    public String targetNamespace() default "";
+    public String className() default "";
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/javax/xml/ws/ResponseWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/javax/xml/ws/ResponseWrapper.java?view=diff&rev=451327&r1=451326&r2=451327
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/javax/xml/ws/ResponseWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/javax/xml/ws/ResponseWrapper.java Fri Sep 29 08:40:07 2006
@@ -24,9 +24,7 @@
 @Retention(RetentionPolicy.RUNTIME)
 public @interface ResponseWrapper {
 
-    public String localName();
-
-    public String targetNamespace();
-
-    public String className();
+    public String localName() default "";
+    public String targetNamespace() default "";
+    public String className() default "";
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java?view=diff&rev=451327&r1=451326&r2=451327
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java Fri Sep 29 08:40:07 2006
@@ -47,6 +47,17 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+/**
+ * An EndpointDescription corresponds to a particular Service Implementation. It
+ * can correspond to either either a client to that impl or the actual service
+ * impl.
+ * 
+ * The EndpointDescription contains information that is relevant to both a
+ * Provider-based and SEI-based (aka Endpoint-based or Java-based) enpdoints.
+ * SEI-based endpoints (whether they have an explicit or implcit SEI) will have
+ * addtional metadata information in an EndpointInterfaceDescription class and
+ * sub-hierachy; Provider-based endpoitns to not have such a hierachy.
+ */
 
 /*
 Working-design information.
@@ -87,6 +98,19 @@
     // This is only set on the service-side, not the client side.  It could
     // be either an SEI class or a service implementation class.
     private Class implOrSEIClass;
+
+    //On Client side, there should be One ServiceClient instance per AxisSerivce
+    private ServiceClient serviceClient = null;
+    
+    public static final String AXIS_SERVICE_PARAMETER = "org.apache.axis2.jaxws.description.EndpointDescription";
+    private static final Log log = LogFactory.getLog(EndpointDescription.class);
+
+    
+    // ===========================================
+    // ANNOTATION related information
+    // ===========================================
+    
+    // ANNOTATION: @WebService and @WebServiceProvider
     // Only one of these two annotations will be set; they are mutually exclusive
     private WebService          webServiceAnnotation;
     private WebServiceProvider  webServiceProviderAnnotation;
@@ -99,24 +123,25 @@
     private String              webService_EndpointInterface;
     private String              webService_Name;
 
-    // ServiceMode annotation (only valid on a Provider-based endpoint)
+    // ANNOTATION: @ServiceMode
+    // Note this is only valid on a Provider-based endpoint
     private ServiceMode         serviceModeAnnotation;
     private Service.Mode        serviceModeValue;
+    // Default ServiceMode.value per JAXWS Spec 7.1 "javax.xml.ServiceMode" pg 79
+    public static final javax.xml.ws.Service.Mode  ServiceMode_DEFAULT = javax.xml.ws.Service.Mode.PAYLOAD;
     
-    // BindingType annotation
+    // ANNOTATION: @BindingType
     private BindingType         bindingTypeAnnotation;
     private String              bindingTypeValue;
+    // Default BindingType.value per JAXWS Spec Sec 7.8 "javax.xml.ws.BindingType" pg 83 
+    // and Sec 1.4 "SOAP Transport and Transfer Bindings" pg 119
+    public static final String  BindingType_DEFAULT = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
     
+    // ANNOTATION: @HandlerChain
+    // TODO: @HandlerChain support
     // TODO: This needs to be a collection of handler descriptions; use JAX-WS Appendix B Handler Chain Configuration File Schema as a starting point
     private ArrayList<String> handlerList = new ArrayList<String>();
 
-    //On Client side, there should be One ServiceClient instance per ServiceDescription instance and One ServiceDescription 
-    //instance per new Web Service.
-    private ServiceClient serviceClient = null;
-    
-    public static final String AXIS_SERVICE_PARAMETER = "org.apache.axis2.jaxws.description.EndpointDescription";
-    private static final Log log = LogFactory.getLog(EndpointDescription.class);
-
     /**
      * Create an EndpointDescription based on the WSDL port.  Note that per the JAX-WS Spec (Final Release, 4/19/2006
      * Section 4.2.3 Proxies, page 55)the "namespace component of the port is the target namespace of the WSDL 
@@ -395,9 +420,14 @@
     }
     
     public Service.Mode getServiceModeValue() {
-        // This 
-        if (serviceModeValue == null && isProviderBased() && getServiceMode() != null) {
-            serviceModeValue = getServiceMode().value();
+        // This annotation is only valid on Provider-based endpoints. 
+        if (isProviderBased() && serviceModeValue == null) {
+            if (getServiceMode() != null) {
+                serviceModeValue = getServiceMode().value();
+            }
+            else {
+                serviceModeValue = ServiceMode_DEFAULT; 
+            }
         }
         return serviceModeValue;
     }
@@ -414,8 +444,14 @@
     }
     
     public String getBindingTypeValue() {
-        if (bindingTypeValue == null && getBindingType() != null) {
-            bindingTypeValue = getBindingType().value();
+        if (bindingTypeValue == null) {
+            if (getBindingType() != null) {
+                bindingTypeValue = getBindingType().value();
+            }
+            else {
+                // No BindingType annotation present; use default value
+                bindingTypeValue = BindingType_DEFAULT;
+            }
         }
         return bindingTypeValue;
     }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java?view=diff&rev=451327&r1=451326&r2=451327
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java Fri Sep 29 08:40:07 2006
@@ -35,8 +35,16 @@
 import org.apache.axis2.jaxws.ExceptionFactory;
 
 /**
+ * An EndpointInterfaceDescription corresponds to a particular SEI-based Service
+ * Implementation. It can correspond to either either a client to that impl or
+ * the actual service impl.
  * 
+ * The EndpointInterfaceDescription contains information that is relevant only
+ * to an SEI-based (aka Endpoint-based or Java-based) enpdoint; Provider-based
+ * endpoint, which are not operation based and do not have an associated SEI,
+ * will not have an an EndpointInterfaceDescription class and sub-hierachy.
  */
+
 /*
 Java Name: SEI Class name
 
@@ -73,11 +81,23 @@
     // specify an @WebService.endpointInterface.
     private Class seiClass;
     
-    // Annotations and cached values
+    // ===========================================
+    // ANNOTATION related information
+    // ===========================================
+    
+    // ANNOTATION: @SOAPBinding
+    // Note this is the Type-level annotation.  See OperationDescription for the Method-level annotation
     private SOAPBinding         soapBindingAnnotation;
     // TODO: Should this be using the jaxws annotation values or should that be wrappered?
-    private javax.jws.soap.SOAPBinding.Style soapBindingStyle;
-    private javax.jws.soap.SOAPBinding.ParameterStyle soapParameterStyle;
+    private javax.jws.soap.SOAPBinding.Style            soapBindingStyle;
+    // Default value per JSR-181 MR Sec 4.7 "Annotation: javax.jws.soap.SOAPBinding" pg 28
+    public static final javax.jws.soap.SOAPBinding.Style SOAPBinding_Style_DEFAULT = javax.jws.soap.SOAPBinding.Style.DOCUMENT;
+    private javax.jws.soap.SOAPBinding.Use              soapBindingUse;
+    // Default value per JSR-181 MR Sec 4.7 "Annotation: javax.jws.soap.SOAPBinding" pg 28
+    public static final javax.jws.soap.SOAPBinding.Use  SOAPBinding_Use_DEFAULT = javax.jws.soap.SOAPBinding.Use.LITERAL;
+    private javax.jws.soap.SOAPBinding.ParameterStyle   soapParameterStyle;
+    // Default value per JSR-181 MR Sec 4.7 "Annotation: javax.jws.soap.SOAPBinding" pg 28
+    public static final javax.jws.soap.SOAPBinding.ParameterStyle SOAPBinding_ParameterStyle_DEFAULT = javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED;
     
     void addOperation(OperationDescription operation) {
         operationDescriptions.add(operation);
@@ -330,23 +350,33 @@
                 soapBindingStyle = getSoapBinding().style();
             }
             else {
-                soapBindingStyle = javax.jws.soap.SOAPBinding.Style.DOCUMENT;
+                soapBindingStyle = SOAPBinding_Style_DEFAULT;
             }
         }
         return soapBindingStyle;
     }
     
+    public javax.jws.soap.SOAPBinding.Use getSoapBindingUse() {
+        if (soapBindingUse == null) {
+            if (getSoapBinding() != null && getSoapBinding().use() != null) {
+                soapBindingUse = getSoapBinding().use();
+            }
+            else {
+                soapBindingUse = SOAPBinding_Use_DEFAULT;
+            }
+        }
+        return soapBindingUse;
+    }
+    
     public javax.jws.soap.SOAPBinding.ParameterStyle getSoapBindingParameterStyle(){
     	if (soapParameterStyle == null) {
             if (getSoapBinding() != null && getSoapBinding().parameterStyle() != null) {
             	soapParameterStyle = getSoapBinding().parameterStyle();
             }
             else {
-            	soapParameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED;
+            	soapParameterStyle = SOAPBinding_ParameterStyle_DEFAULT;
             }
         }
         return soapParameterStyle;
     }
-
-
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java?view=diff&rev=451327&r1=451326&r2=451327
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/OperationDescription.java Fri Sep 29 08:40:07 2006
@@ -34,7 +34,13 @@
 import org.apache.axis2.description.AxisOperation;
 
 /**
+ * An OperationDescripton corresponds to a method on an SEI.  That SEI could be explicit
+ * (i.e. @WebService.endpointInterface=sei.class) or implicit (i.e. public methods on the service implementation
+ * are the contract and thus the implicit SEI).  Note that while OperationDescriptions are created on both the client
+ * and service side, implicit SEIs will only occur on the service side.
  * 
+ * OperationDescriptons contain information that is only relevent for and SEI-based service, i.e. one that is invoked via specific
+ * methods.  This class does not exist for Provider-based services (i.e. those that specify @WebServiceProvider)
  */
 /*
 Java Name: Method name from SEI
@@ -87,31 +93,53 @@
     private QName operationName;
     private Method seiMethod;
 
-    // Annotations and related cached values
+    // ===========================================
+    // ANNOTATION related information
+    // ===========================================
+    
+    // ANNOTATION: @Oneway
     private Oneway              onewayAnnotation;
     private Boolean             onewayIsOneway;
     
+    // ANNOTATION: @RequestWrapper
     private RequestWrapper      requestWrapperAnnotation;
     private String              requestWrapperTargetNamespace;
     private String              requestWrapperLocalName;
     private String              requestWrapperClassName;
     
+    // ANNOTATION: @ResponseWrapper
     private ResponseWrapper     responseWrapperAnnotation;
     private String              responseWrapperLocalName;
     private String              responseWrapperTargetNamespace;
     private String              responseWrapperClassName;
     
+    // ANNOTATION: @SOAPBinding
+    // Note this is the Method-level annotation.  See EndpointInterfaceDescription for the Method-level annotation
+    // Also note this annotation is only allowed on methods if SOAPBinding.Style is DOCUMENT and if the method-level
+    // annotation is absent, the behavior defined on the Type is used.
+    // per JSR-181 MR Sec 4.7 "Annotation: javax.jws.soap.SOAPBinding" pg 28
     private SOAPBinding         soapBindingAnnotation;
     // REVIEW: Should this be using the jaxws annotation values or should that be wrappered?
-    private javax.jws.soap.SOAPBinding.Style soapBindingStyle;
+    private javax.jws.soap.SOAPBinding.Style            soapBindingStyle;
+    public static final javax.jws.soap.SOAPBinding.Style SoapBinding_Style_VALID = javax.jws.soap.SOAPBinding.Style.DOCUMENT;
+    private javax.jws.soap.SOAPBinding.Use              soapBindingUse;
+    // Default value per JSR-181 MR Sec 4.7 "Annotation: javax.jws.soap.SOAPBinding" pg 28
+    public static final javax.jws.soap.SOAPBinding.Use  SOAPBinding_Use_DEFAULT = javax.jws.soap.SOAPBinding.Use.LITERAL;
+    private javax.jws.soap.SOAPBinding.ParameterStyle   soapBindingParameterStyle;
+    // Default value per JSR-181 MR Sec 4.7 "Annotation: javax.jws.soap.SOAPBinding" pg 28
+    public static final javax.jws.soap.SOAPBinding.ParameterStyle SOAPBinding_ParameterStyle_DEFAULT = javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED;
+
     
+    // ANNOTATION: @WebMethod
     private WebMethod           webMethodAnnotation;
     private String              webMethodOperationName;
     
+    // ANNOTATION: @WebParam
     // TODO: Should WebParam annotation be moved to the ParameterDescription?
     private WebParam[]          webParamAnnotations;
     private String[]            webParamNames;
     
+    // ANNOTATION: @WebResult
     private WebResult           webResultAnnotation;
     private String              webResultName;
     
@@ -176,11 +204,14 @@
     public Method getSEIMethod() {
         return seiMethod;
     }
-
-    // Annotation-related getters
+    
+    private boolean isWrappedParameters() {
+        // TODO: WSDL may need to be considered in this check as well
+        return getSoapBindingParameterStyle() == javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED;
+    }
 
     // =====================================
-    // WebMethod annotation related methods
+    // ANNOTATION: WebMethod
     // =====================================
     WebMethod getWebMethod() {
         return webMethodAnnotation;
@@ -193,7 +224,8 @@
     private static String determineOperationName(Method javaMethod) {
         String operationName = null;
         WebMethod wmAnnotation = javaMethod.getAnnotation(WebMethod.class);
-        // Per JSR-181, if @WebMethod specifies and operation name, use that.  Otherwise
+        // Per JSR-181 MR Sec 4.2 "Annotation: javax.jws.WebMethod" pg 17,
+        // if @WebMethod specifies and operation name, use that.  Otherwise
         // default is the Java method name
         if (wmAnnotation != null && !DescriptionUtils.isEmpty(wmAnnotation.operationName())) {
             operationName = wmAnnotation.operationName();
@@ -213,7 +245,7 @@
     }
     
     // ==========================================
-    // RequestWrapper Annotation related methods
+    // ANNOTATION: RequestWrapper
     // ==========================================
     RequestWrapper getRequestWrapper() {
         if (requestWrapperAnnotation == null) {
@@ -222,13 +254,22 @@
         return requestWrapperAnnotation;
     }
     
+    /**
+     * For wrapped parameter style (based on the annotation and the WSDL), returns the 
+     * wrapper value.  For non-wrapped (i.e. bare) parameter style, returns null.
+     * @return
+     */
     public String getRequestWrapperLocalName() {
+        if (!isWrappedParameters()) {
+            // A wrapper is only meaningful for wrapped parameters
+            return null;
+        }
         if (requestWrapperLocalName == null) {
-            if (getRequestWrapper() != null && !DescriptionUtils.isEmpty(getRequestWrapper().localName())) {
+            if (getRequestWrapper() != null
+                    && !DescriptionUtils.isEmpty(getRequestWrapper().localName())) {
                 requestWrapperLocalName = getRequestWrapper().localName();
-            }
-            else { 
-                // The default value of localName is the value of operationName as 
+            } else {
+                // The default value of localName is the value of operationName as
                 // defined in the WebMethod annotation. [JAX-WS Sec. 7.3, p. 80]
                 requestWrapperLocalName = getWebMethodOperationName();
             }
@@ -236,7 +277,16 @@
         return requestWrapperLocalName;
     }
     
+    /**
+     * For wrapped parameter style (based on the annotation and the WSDL), returns the 
+     * wrapper value.  For non-wrapped (i.e. bare) parameter style, returns null.
+     * @return
+     */
     public String getRequestWrapperTargetNamespace() {
+        if (!isWrappedParameters()) {
+            // A wrapper is only meaningful for wrapped parameters
+            return null;
+        }
         if (requestWrapperTargetNamespace == null) {
             if (getRequestWrapper() != null && !DescriptionUtils.isEmpty(getRequestWrapper().targetNamespace())) {
                 requestWrapperTargetNamespace = getRequestWrapper().targetNamespace();
@@ -250,7 +300,16 @@
         return requestWrapperTargetNamespace;
     }
     
+    /**
+     * For wrapped parameter style (based on the annotation and the WSDL), returns the 
+     * wrapper value.  For non-wrapped (i.e. bare) parameter style, returns null.
+     * @return
+     */
     public String getRequestWrapperClassName() {
+        if (!isWrappedParameters()) {
+            // A wrapper is only meaningful for wrapped parameters
+            return null;
+        }
         if (requestWrapperClassName == null) {
             if (getRequestWrapper() != null && !DescriptionUtils.isEmpty(getRequestWrapper().className())) {
                 requestWrapperClassName = getRequestWrapper().className();
@@ -270,7 +329,7 @@
     }
     
     // ===========================================
-    // ResponseWrapper Annotation related methods
+    // ANNOTATION: ResponseWrapper
     // ===========================================
     ResponseWrapper getResponseWrapper() {
         if (responseWrapperAnnotation == null) {
@@ -279,7 +338,16 @@
         return responseWrapperAnnotation;
     }
     
+    /**
+     * For wrapped parameter style (based on the annotation and the WSDL), returns the 
+     * wrapper value.  For non-wrapped (i.e. bare) parameter style, returns null.
+     * @return
+     */
     public String getResponseWrapperLocalName() {
+        if (!isWrappedParameters()) {
+            // A wrapper is only meaningful for wrapped parameters
+            return null;
+        }
         if (responseWrapperLocalName == null) {
             if (getResponseWrapper() != null && !DescriptionUtils.isEmpty(getResponseWrapper().localName())) {
                 responseWrapperLocalName = getResponseWrapper().localName();
@@ -293,7 +361,16 @@
         return responseWrapperLocalName;
     }
     
+    /**
+     * For wrapped parameter style (based on the annotation and the WSDL), returns the 
+     * wrapper value.  For non-wrapped (i.e. bare) parameter style, returns null.
+     * @return
+     */
     public String getResponseWrapperTargetNamespace() {
+        if (!isWrappedParameters()) {
+            // A wrapper is only meaningful for wrapped parameters
+            return null;
+        }
         if (responseWrapperTargetNamespace == null) {
             if (getResponseWrapper() != null && !DescriptionUtils.isEmpty(getResponseWrapper().targetNamespace())) {
                 responseWrapperTargetNamespace = getResponseWrapper().targetNamespace();
@@ -307,7 +384,16 @@
         return responseWrapperTargetNamespace;
     }
     
+    /**
+     * For wrapped parameter style (based on the annotation and the WSDL), returns the 
+     * wrapper value.  For non-wrapped (i.e. bare) parameter style, returns null.
+     * @return
+     */
     public String getResponseWrapperClassName() {
+        if (!isWrappedParameters()) {
+            // A wrapper is only meaningful for wrapped parameters
+            return null;
+        }
         if (responseWrapperClassName == null) {
             if (getResponseWrapper() != null && !DescriptionUtils.isEmpty(getResponseWrapper().className())) {
                 responseWrapperClassName = getResponseWrapper().className();
@@ -327,7 +413,7 @@
     }
 
     // ===========================================
-    // WebParam Annotation related methods
+    // ANNOTATION: WebParam
     // ===========================================
     // TODO: Should this annotation be moved to ParameterDescription 
     WebParam[] getWebParam() {
@@ -367,7 +453,7 @@
     }
     
     // ===========================================
-    // WebResult Annotation related methods
+    // ANNOTATION: WebResult
     // ===========================================
     WebResult getWebResult() {
         if (webResultAnnotation == null) {
@@ -394,29 +480,58 @@
     }
 
     // ===========================================
-    // SOAPBinding Annotation related methods
+    // ANNOTATION: SOAPBinding
     // ===========================================
     SOAPBinding getSoapBinding() {
+        // TODO: VALIDATION: Only style of DOCUMENT allowed on Method annotation; remember to check the Type's style setting also
+        //       JSR-181 Sec 4.7 p. 28
         if (soapBindingAnnotation == null) {
             soapBindingAnnotation = seiMethod.getAnnotation(SOAPBinding.class);
         }
         return soapBindingAnnotation;
     }
-    
+
     public javax.jws.soap.SOAPBinding.Style getSoapBindingStyle() {
         if (soapBindingStyle == null) {
             if (getSoapBinding() != null && getSoapBinding().style() != null) {
                 soapBindingStyle = getSoapBinding().style();
             }
             else {
-                soapBindingStyle = javax.jws.soap.SOAPBinding.Style.DOCUMENT;
+                // Per JSR-181 MR Sec 4.7, pg 28: if not specified, use the Type value.
+                soapBindingStyle = getEndpointInterfaceDescription().getSoapBindingStyle(); 
             }
         }
         return soapBindingStyle;
     }
     
+    public javax.jws.soap.SOAPBinding.Use getSoapBindingUse() {
+        if (soapBindingUse == null) {
+            if (getSoapBinding() != null && getSoapBinding().use() != null) {
+                soapBindingUse = getSoapBinding().use();
+            }
+            else {
+                // Per JSR-181 MR Sec 4.7, pg 28: if not specified, use the Type value.
+                soapBindingUse = getEndpointInterfaceDescription().getSoapBindingUse(); 
+            }
+        }
+        return soapBindingUse;
+    }
+
+    public javax.jws.soap.SOAPBinding.ParameterStyle getSoapBindingParameterStyle() {
+        if (soapBindingParameterStyle == null) {
+            if (getSoapBinding() != null && getSoapBinding().use() != null) {
+                soapBindingParameterStyle = getSoapBinding().parameterStyle();
+            }
+            else {
+                // Per JSR-181 MR Sec 4.7, pg 28: if not specified, use the Type value.
+                soapBindingParameterStyle = getEndpointInterfaceDescription().getSoapBindingParameterStyle(); 
+            }
+        }
+        return soapBindingParameterStyle;
+    }
+    
     // ===========================================
-    // OneWay Annotation related methods
+    // ANNOTATION: OneWay
     // ===========================================
     Oneway getOnewayAnnotation() {
         if (onewayAnnotation == null) {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java?view=diff&rev=451327&r1=451326&r2=451327
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java Fri Sep 29 08:40:07 2006
@@ -107,8 +107,6 @@
     // Only ONE of the following will be set in a ServiceDescription, depending on whether this Description
     // was created from a service-requester or service-provider flow. 
     private Class serviceClass;         // A service-requester generated service or generic service class
-    private Class serviceImplClass;     // A service-provider service implementation class.  The impl
-                                        // could be a Provider (no SEI operations) or an Endpoint (SEI based operations) 
     
     // TODO: Possibly remove Definition and delegate to the Defn on the AxisSerivce set as a paramater by WSDLtoAxisServicBuilder?
     private WSDLWrapper wsdlWrapper; 
@@ -157,7 +155,6 @@
     //       based on the annotations in the ServiceImpl class.
     // TODO: Remove axisService as paramater when the AxisService can be constructed from the annotations
     ServiceDescription(Class serviceImplClass, AxisService axisService) {
-        this.serviceImplClass = serviceImplClass;
         // Create the EndpointDescription hierachy from the service impl annotations; Since the PortQName is null, 
         // it will be set to the annotation value.
         EndpointDescription endpointDescription = new EndpointDescription(serviceImplClass, null, axisService, this);

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationProviderImplDescriptionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationProviderImplDescriptionTests.java?view=diff&rev=451327&r1=451326&r2=451327
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationProviderImplDescriptionTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationProviderImplDescriptionTests.java Fri Sep 29 08:40:07 2006
@@ -104,9 +104,8 @@
         
         // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)?  Currently assumes [0]
         EndpointDescription testEndpointDesc = endpointDesc[0];
-        // TODO: In the abscence of the service mode annotation, should a reasonable default be returned?
-        assertNull(testEndpointDesc.getServiceModeValue());
-        assertNull(testEndpointDesc.getBindingTypeValue());
+        assertEquals(javax.xml.ws.Service.Mode.PAYLOAD, testEndpointDesc.getServiceModeValue());
+        assertEquals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING, testEndpointDesc.getBindingTypeValue());
     }
     
     public void testNoWebServiceProvider() {
@@ -138,6 +137,22 @@
             fail ("Wrong exception caught.  Expected WebServiceException but caught " + e);
         }
     }
+    
+    public void testServiceModeOnNonProvider() {
+        // Use the description factory directly; this will be done within the JAX-WS runtime
+        ServiceDescription serviceDesc = 
+            DescriptionFactory.createServiceDescriptionFromServiceImpl(WebServiceSEITestImpl.class, null);
+        assertNotNull(serviceDesc);
+        
+        EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
+        assertNotNull(endpointDesc);
+        assertEquals(1, endpointDesc.length);
+        
+        // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)?  Currently assumes [0]
+        EndpointDescription testEndpointDesc = endpointDesc[0];
+        assertNull(testEndpointDesc.getServiceModeValue());
+        assertEquals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING, testEndpointDesc.getBindingTypeValue());
+    }
 }
 
 // ===============================================
@@ -212,5 +227,17 @@
     public SOAPMessage invoke(SOAPMessage obj) {
         return null;
     }  
+}
+
+// ===============================================
+// WebService service implementation class; not 
+// Provider-based
+// ===============================================
+
+@WebService()
+class WebServiceSEITestImpl {
+    public String echo (String s) {
+        return "From WebServiceSEITestImpl " + "s";
+    }
 }
 

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java?view=diff&rev=451327&r1=451326&r2=451327
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java Fri Sep 29 08:40:07 2006
@@ -18,7 +18,10 @@
 
 package org.apache.axis2.jaxws.description;
 
+import javax.jws.WebService;
 import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
 
 import junit.framework.TestCase;
 
@@ -258,4 +261,221 @@
         assertEquals(true, operations[0].isWebResultAnnotationSpecified());
         assertEquals("return_str", operations[0].getWebResultName());
     }
+    
+    // ===========================================
+    // The following tests use implementation classes defined below
+    // in order to test various specific annotation settings
+    // ===========================================
+    
+    public void testSOAPBindingDefault() {
+        EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(SOAPBindingDefaultTestImpl.class);
+        
+        assertNull(testEndpointInterfaceDesc.getSoapBinding());
+        assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT, testEndpointInterfaceDesc.getSoapBindingStyle());
+        assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL, testEndpointInterfaceDesc.getSoapBindingUse());
+        assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED, testEndpointInterfaceDesc.getSoapBindingParameterStyle());
+    }
+
+    public void testSOAPBindingDocEncBare() {
+        EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(SOAPBindingDocEncBareTestImpl.class);
+        
+        assertNotNull(testEndpointInterfaceDesc.getSoapBinding());
+        assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT, testEndpointInterfaceDesc.getSoapBindingStyle());
+        assertEquals(javax.jws.soap.SOAPBinding.Use.ENCODED, testEndpointInterfaceDesc.getSoapBindingUse());
+        assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE, testEndpointInterfaceDesc.getSoapBindingParameterStyle());
+    }
+    
+    public void testSOAPBindingMethodAnnotation() {
+        // Verify that an impl without the method annotation uses the settings from the type
+        EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(SOAPBindingDocEncBareTestImpl.class);
+
+        assertNotNull(testEndpointInterfaceDesc.getSoapBinding());
+        assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT, testEndpointInterfaceDesc.getSoapBindingStyle());
+        assertEquals(javax.jws.soap.SOAPBinding.Use.ENCODED, testEndpointInterfaceDesc.getSoapBindingUse());
+        assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE, testEndpointInterfaceDesc.getSoapBindingParameterStyle());
+
+        OperationDescription operationDesc = testEndpointInterfaceDesc.getOperation("echoString")[0];
+        assertNotNull(operationDesc);
+        assertNull(operationDesc.getSoapBinding());
+        assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT, operationDesc.getSoapBindingStyle());
+        assertEquals(javax.jws.soap.SOAPBinding.Use.ENCODED, operationDesc.getSoapBindingUse());
+        assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE, operationDesc.getSoapBindingParameterStyle());
+        
+        // Verify that the method annotation setting overrides the type annotatino setting
+        testEndpointInterfaceDesc = getEndpointInterfaceDesc(SOAPBindingDefaultMethodTestImpl.class);
+        
+        assertNull(testEndpointInterfaceDesc.getSoapBinding());
+        assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT, testEndpointInterfaceDesc.getSoapBindingStyle());
+        assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL, testEndpointInterfaceDesc.getSoapBindingUse());
+        assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED, testEndpointInterfaceDesc.getSoapBindingParameterStyle());
+
+        operationDesc = testEndpointInterfaceDesc.getOperation("echoString")[0];
+        assertNotNull(operationDesc);
+        assertNotNull(operationDesc.getSoapBinding());
+        assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT, operationDesc.getSoapBindingStyle());
+        assertEquals(javax.jws.soap.SOAPBinding.Use.ENCODED, operationDesc.getSoapBindingUse());
+        assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE, operationDesc.getSoapBindingParameterStyle());
+    }
+    
+    public void testDefaultReqRspWrapper() {
+
+        // Test paramaterStyle = WRAPPED set a the type level with various combinations of method annotation setting
+        EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(DefaultReqRspWrapperTestImpl.class);
+        OperationDescription operationDesc = testEndpointInterfaceDesc.getOperation("wrappedParams")[0];
+        assertNotNull(operationDesc);
+        assertEquals("wrappedParams", operationDesc.getRequestWrapperLocalName());
+        assertEquals("wrappedParamsResponse", operationDesc.getResponseWrapperLocalName());
+        // TODO: Tests for request and response wrapper namespace; currently throws UnsupportedOperationException
+        assertEquals("org.apache.axis2.jaxws.description.WrappedParams", operationDesc.getRequestWrapperClassName());
+        assertEquals("org.apache.axis2.jaxws.description.WrappedParams", operationDesc.getResponseWrapperClassName());
+
+        operationDesc = testEndpointInterfaceDesc.getOperation("bareParams")[0];
+        assertNotNull(operationDesc);
+        assertNull(operationDesc.getRequestWrapperLocalName());
+        assertNull(operationDesc.getResponseWrapperLocalName());
+        assertNull(operationDesc.getRequestWrapperTargetNamespace());
+        assertNull(operationDesc.getResponseWrapperTargetNamespace());
+        assertNull(operationDesc.getRequestWrapperClassName());
+        assertNull(operationDesc.getResponseWrapperClassName());
+
+        // Test paramaterStyle = BARE set a the type level with various combinations of method annotation setting
+        testEndpointInterfaceDesc = getEndpointInterfaceDesc(DefaultReqRspWrapperBareTestImpl.class);
+        operationDesc = testEndpointInterfaceDesc.getOperation("wrappedParams")[0];
+        assertNotNull(operationDesc);
+        assertEquals("wrappedParams", operationDesc.getRequestWrapperLocalName());
+        assertEquals("wrappedParamsResponse", operationDesc.getResponseWrapperLocalName());
+        // TODO: Tests for request and response wrapper namespace; currently throws UnsupportedOperationException
+        assertEquals("org.apache.axis2.jaxws.description.WrappedParams", operationDesc.getRequestWrapperClassName());
+        assertEquals("org.apache.axis2.jaxws.description.WrappedParams", operationDesc.getResponseWrapperClassName());
+
+        operationDesc = testEndpointInterfaceDesc.getOperation("bareParams")[0];
+        assertNotNull(operationDesc);
+        assertNull(operationDesc.getRequestWrapperLocalName());
+        assertNull(operationDesc.getResponseWrapperLocalName());
+        assertNull(operationDesc.getRequestWrapperTargetNamespace());
+        assertNull(operationDesc.getResponseWrapperTargetNamespace());
+        assertNull(operationDesc.getRequestWrapperClassName());
+        assertNull(operationDesc.getResponseWrapperClassName());
+    }
+    
+    public void testReqRspWrapper() {
+        EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(ReqRspWrapperTestImpl.class);
+        OperationDescription operationDesc = testEndpointInterfaceDesc.getOperation("method1")[0];
+        assertNotNull(operationDesc);
+        assertEquals("method1ReqWrapper", operationDesc.getRequestWrapperLocalName());
+        assertEquals("method1RspWrapper", operationDesc.getResponseWrapperLocalName());
+        assertEquals("http://a.b.c.method1ReqTNS", operationDesc.getRequestWrapperTargetNamespace());
+        assertEquals("http://a.b.c.method1RspTNS", operationDesc.getResponseWrapperTargetNamespace());
+        assertEquals("org.apache.axis2.jaxws.description.method1ReqWrapper", operationDesc.getRequestWrapperClassName());
+        assertEquals("org.apache.axis2.jaxws.description.method1RspWrapper", operationDesc.getResponseWrapperClassName());
+
+        operationDesc = testEndpointInterfaceDesc.getOperation("method2")[0];
+        assertEquals("method2", operationDesc.getRequestWrapperLocalName());
+        assertEquals("method2RspWrapper", operationDesc.getResponseWrapperLocalName());
+        assertEquals("http://a.b.c.method2ReqTNS", operationDesc.getRequestWrapperTargetNamespace());
+        assertEquals("http://a.b.c.method2RspTNS", operationDesc.getResponseWrapperTargetNamespace());
+        assertEquals("org.apache.axis2.jaxws.description.method2ReqWrapper", operationDesc.getRequestWrapperClassName());
+        assertEquals("org.apache.axis2.jaxws.description.Method2", operationDesc.getResponseWrapperClassName());
+    }
+
+    /*
+     * Method to return the endpoint interface description for a given implementation class.
+     */
+    private EndpointInterfaceDescription getEndpointInterfaceDesc(Class implementationClass) {
+        // Use the description factory directly; this will be done within the JAX-WS runtime
+        ServiceDescription serviceDesc = 
+            DescriptionFactory.createServiceDescriptionFromServiceImpl(implementationClass, null);
+        assertNotNull(serviceDesc);
+        
+        EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
+        assertNotNull(endpointDesc);
+        assertEquals(1, endpointDesc.length);
+        
+        // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)?  Currently assumes [0]
+        EndpointDescription testEndpointDesc = endpointDesc[0];
+        EndpointInterfaceDescription testEndpointInterfaceDesc = testEndpointDesc.getEndpointInterfaceDescription();
+        assertNotNull(testEndpointInterfaceDesc);
+
+        return testEndpointInterfaceDesc;
+    }
+}
+
+// ============================================================================
+// SOAPBindingDefaultTest service implementation class
+// ============================================================================
+@WebService()
+class SOAPBindingDefaultTestImpl {
+    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 should default to DOCUMENT based on Type annotation
+// ============================================================================
+@WebService()
+class SOAPBindingDefaultMethodTestImpl {
+    @SOAPBinding(use=javax.jws.soap.SOAPBinding.Use.ENCODED, parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
+    public String echoString (String s) {
+        return s;
+    }
+}
+
+// =============================================================================
+// testDefaultReqRspWrapper service implementation classes
+// =============================================================================
+@WebService
+//Note the default parameterStyle is WRAPPED, so no type-level annotation is required.
+class DefaultReqRspWrapperTestImpl {
+    public String wrappedParams (String s) {
+        return s;
+    }
+    
+    @SOAPBinding(parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
+    public String bareParams (String s) {
+        return s;
+    }
+}
+
+@WebService
+@SOAPBinding(parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
+class DefaultReqRspWrapperBareTestImpl {
+    @SOAPBinding(parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED)
+    public String wrappedParams (String s) {
+        return s;
+    }
+    
+    public String bareParams (String s) {
+        return s;
+    }
+}
+
+// =============================================================================
+// testReqRspWrapper service implementation class
+// =============================================================================
+@WebService
+//Note the default parameterStyle is WRAPPED, so no type-level annotation is required.
+class ReqRspWrapperTestImpl {
+    @RequestWrapper(localName="method1ReqWrapper", targetNamespace="http://a.b.c.method1ReqTNS", className="org.apache.axis2.jaxws.description.method1ReqWrapper")
+    @ResponseWrapper(localName="method1RspWrapper", targetNamespace="http://a.b.c.method1RspTNS", className="org.apache.axis2.jaxws.description.method1RspWrapper")
+    public String method1 (String s) {
+        return s;
+    }
+
+    @RequestWrapper(targetNamespace="http://a.b.c.method2ReqTNS", className="org.apache.axis2.jaxws.description.method2ReqWrapper")
+    @ResponseWrapper(localName="method2RspWrapper", targetNamespace="http://a.b.c.method2RspTNS")
+    public String method2 (String s) {
+        return s;
+    }
+}   
\ 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