Author: jkaputin
Date: Sun Jun  4 18:06:03 2006
New Revision: 411632

URL: http://svn.apache.org/viewvc?rev=411632&view=rev
Log:
Corrected http extensions to reflect the existing
Part 2 spec, rather than the proposed improvements.
Modified some comments too.

Modified:
    
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingFaultExtensionsImpl.java
    
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsImpl.java
    
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.java
    
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingFaultExtensionsTest.java
    
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingExtensions.wsdl
    
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingFaultExtensions.wsdl

Modified: 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingFaultExtensionsImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingFaultExtensionsImpl.java?rev=411632&r1=411631&r2=411632&view=diff
==============================================================================
--- 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingFaultExtensionsImpl.java
 (original)
+++ 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingFaultExtensionsImpl.java
 Sun Jun  4 18:06:03 2006
@@ -72,9 +72,6 @@
     /* (non-Javadoc)
      * @see 
org.apache.woden.wsdl20.extensions.http.HTTPBindingFaultExtensions#getHttpTransferCoding()
      * 
-     * TODO check response to ws-desc posting 26May06 about whether this 
should default to 
-     * BindingOperation {http transfer coding default} as stated in the spec. 
For now, have
-     * assumed that it defaults to Binding {http transfer coding default}
      */
     public String getHttpTransferCoding() 
     {
@@ -84,19 +81,23 @@
             return tfrCoding.getString();
         }
         
-        /*TODO resolve transfer coding issues with the spec, rather than 
making the following assumption
+        return null; //TODO remove if default changed as below. 
+
+        /* TODO Per ws-desc post 26May06, seeking clarification of defaults
+         * for {http transfer coding}, as Part 2 section 6.8.2 currently says
+         * the default is BindingOperation {http transfer coding default}. 
+         * If Part 2 spec is modified to explicitly default this to Binding
+         * {http transfer coding default} then uncomment the following code.
          * 
-        //if transfer coding is null, return the transfer coding default in 
Binding
-        Binding binding = (Binding) ((BindingFault)fParent).getParent();
-        HTTPBindingExtensions httpBindExts = (HTTPBindingExtensions)
-            
binding.getComponentExtensionsForNamespace(HTTPConstants.NS_URI_HTTP);
-        
-        //Binding has REQUIRED HTTP extension properties so 
HTTPBindingExtensions must be 
-        //present (i.e. no need to check for null httpBindExts).
-        return httpBindExts.getHttpTransferCodingDefault();
+         * //if transfer coding is null, return the transfer coding default in 
Binding
+         * Binding binding = (Binding) ((BindingFault)fParent).getParent();
+         * HTTPBindingExtensions httpBindExts = (HTTPBindingExtensions)
+         *     
binding.getComponentExtensionsForNamespace(HTTPConstants.NS_URI_HTTP);
+         * 
+         * //Binding has REQUIRED HTTP extension properties so 
HTTPBindingExtensions must be 
+         * //present (i.e. no need to check for null httpBindExts).
+         * return httpBindExts.getHttpTransferCodingDefault();
          */
-        
-        return null; //TODO conforms to the current spec, but pending 
resolution of issues via ws-desc mailing list
     }
 
     /* (non-Javadoc)

Modified: 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsImpl.java?rev=411632&r1=411631&r2=411632&view=diff
==============================================================================
--- 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsImpl.java
 (original)
+++ 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsImpl.java
 Sun Jun  4 18:06:03 2006
@@ -16,8 +16,10 @@
 package org.apache.woden.internal.wsdl20.extensions.http;
 
 import org.apache.woden.internal.wsdl20.extensions.ComponentExtensionsImpl;
+import org.apache.woden.wsdl20.BindingOperation;
 import org.apache.woden.wsdl20.extensions.ExtensionElement;
 import 
org.apache.woden.wsdl20.extensions.http.HTTPBindingMessageReferenceExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions;
 import org.apache.woden.wsdl20.extensions.http.HTTPHeader;
 import org.apache.woden.wsdl20.xml.WSDLElement;
 import org.apache.woden.xml.StringAttr;
@@ -42,7 +44,20 @@
     {
         StringAttr tfrCoding = (StringAttr) ((WSDLElement)fParent)
             .getExtensionAttribute(HTTPConstants.Q_ATTR_TRANSFER_CODING);
-        return tfrCoding != null ? tfrCoding.getString() : null; 
+        if(tfrCoding != null) {
+            return tfrCoding.getString();
+        }
+        
+        //Part 2, 6.8.2 Relationship to WSDL Component Model, default to
+        //BindingOperation {http transfer coding default}
+        
+        BindingOperation bindOper = (BindingOperation) fParent;
+        HTTPBindingOperationExtensions httpBindOperExts = 
(HTTPBindingOperationExtensions)
+            
bindOper.getComponentExtensionsForNamespace(HTTPConstants.NS_URI_HTTP);
+        
+        //No need to null check httpBindOperExts because BindingOperation has 
+        //REQUIRED http extension properties, so it must be present. 
+        return httpBindOperExts.getHttpTransferCodingDefault();
     }
 
     /* (non-Javadoc)

Modified: 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.java?rev=411632&r1=411631&r2=411632&view=diff
==============================================================================
--- 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.java
 (original)
+++ 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.java
 Sun Jun  4 18:06:03 2006
@@ -18,11 +18,8 @@
 import java.net.URI;
 
 import org.apache.woden.internal.wsdl20.extensions.ComponentExtensionsImpl;
-import org.apache.woden.internal.wsdl20.extensions.ExtensionConstants;
 import org.apache.woden.wsdl20.Binding;
 import org.apache.woden.wsdl20.BindingOperation;
-import org.apache.woden.wsdl20.InterfaceOperation;
-import org.apache.woden.wsdl20.extensions.InterfaceOperationExtensions;
 import org.apache.woden.wsdl20.extensions.http.HTTPBindingExtensions;
 import org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions;
 import org.apache.woden.wsdl20.xml.WSDLElement;
@@ -74,13 +71,18 @@
         * 
         * @see 
org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#getHttpMethod()
         * 
-        * 1. If whttp:method is present on the binding operation use it. 2.
-        * Otherwise, if whttp:methodDefault is present on the binding use it. 
3.
-        * Otherwise, if the {safety} extension property of InterfaceOperation 
is
-        * 'true' return "GET". 4. Otherwise, return "POST"
+        * 1. Return whttp:method if present on the binding operation. 
+     * 2. Otherwise return null
+     * 
+     * TODO implement steps 2,3,4 below if Part 2 spec is modified
+     * to reflect ws-desc posting 30May06 about moving this default 
+     * behaviour from binding rules into the component model. 
+     * 2. Otherwise, return whttp:methodDefault if present on the binding.
+     * 3. Otherwise, return "GET" if the {safety} extension property of 
+     *    InterfaceOperation is 'true'. 
+     * 4. Otherwise, return "POST"
         */
        public String getHttpMethod() {
-               String method = null;
 
                // 1. try whttp:method
                StringAttr methodAttr = (StringAttr) ((WSDLElement) fParent)
@@ -89,42 +91,44 @@
                        return methodAttr.getString();
                }
 
-               // 2. try whttp:methodDefault
-
-               Binding binding = (Binding) ((BindingOperation) 
fParent).getParent();
-
-               HTTPBindingExtensions httpBindExts = (HTTPBindingExtensions) 
binding
-                               
.getComponentExtensionsForNamespace(HTTPConstants.NS_URI_HTTP);
-
-               // no need to check for a null httpBindExts because Binding has 
REQUIRED
-               // http extension properties
-               String methodDef = httpBindExts.getHttpMethodDefault();
-               if (methodDef != null) {
-                       return methodDef;
-               }
-
-               /*
-                * 3. try {safety}
-                * 
-                * To get here via the Woden programming model the Component 
model must
-                * have been initialized correctly (i.e. the Description 
component can
-                * be referenced from the Binding), so it's safe to cast the 
parent
-                * binding operation element to a BindingOperation component.
-                */
-               InterfaceOperation intOper = ((BindingOperation) fParent)
-                               .getInterfaceOperation();
-               if (intOper != null) {
-                       InterfaceOperationExtensions intOperExts = 
(InterfaceOperationExtensions) intOper
-                                       .getComponentExtensionsForNamespace(URI
-                                                       
.create(ExtensionConstants.NS_URI_WSDL_EXTENSIONS));
-                       if (intOperExts != null && intOperExts.isSafety()) {
-                               return HTTPConstants.METHOD_GET;
-                       }
-               }
-
-               // TODO Default POST not in spec yet, but confirmed via ws-desc 
posting
-               // 30May06. Remove this todo when spec updated.
-               return HTTPConstants.METHOD_POST;
+        // 2. return null (i.e. no default specified in the spec...yet) 
+        return null; //TODO remove if default behaviour below is used.
+        
+
+        /* TODO Uncomment the following code if the defaults descibed for 
+         * binding rules in Part 2, 6.3.1 HTTP Method Selection, are moved
+         * into the Component model (i.e. the defaults are applied in the 
+         * component model, not left to the binder to enforce them.
+         * See posting ws-desc 30May06.
+         *
+         * // 2. try whttp:methodDefault
+         * Binding binding = (Binding) ((BindingOperation) 
fParent).getParent();
+         * 
+         * HTTPBindingExtensions httpBindExts = (HTTPBindingExtensions) binding
+         *         
.getComponentExtensionsForNamespace(HTTPConstants.NS_URI_HTTP);
+         * 
+         * // no need to check for a null httpBindExts because Binding has 
REQUIRED
+         * // http extension properties
+         * String methodDef = httpBindExts.getHttpMethodDefault();
+         * if (methodDef != null) {
+         *     return methodDef;
+         * }
+         *        
+                * // 3. try {safety}
+                * InterfaceOperation intOper = ((BindingOperation) fParent)
+                *         .getInterfaceOperation();
+                * if (intOper != null) {
+                *    InterfaceOperationExtensions intOperExts = 
(InterfaceOperationExtensions) intOper
+                *            .getComponentExtensionsForNamespace(URI
+                *                    
.create(ExtensionConstants.NS_URI_WSDL_EXTENSIONS));
+                *    if (intOperExts != null && intOperExts.isSafety()) {
+                *       return HTTPConstants.METHOD_GET;
+                *    }
+                * }
+         *
+                * // 4. default to POST.
+                * return HTTPConstants.METHOD_POST;
+         */
        }
 
        /*
@@ -133,6 +137,7 @@
         * @see 
org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#getHttpInputSerialization()
         */
        public String getHttpInputSerialization() {
+        
                StringAttr serialization = (StringAttr) ((WSDLElement) fParent)
                                
.getExtensionAttribute(HTTPConstants.Q_ATTR_INPUT_SERIALIZATION);
                if (serialization != null) {
@@ -140,12 +145,17 @@
                }
 
                String method = getHttpMethod();
+        
+        //TODO Remove following null return if the Part 2 spec is improved
+        //so that BindingOperation {http method} does not just default 
+        //to null (see ws-desc posting 30May06)
+        if(method == null) return null;
+        
                if (method.equals(HTTPConstants.METHOD_GET)
                                || method.equals(HTTPConstants.METHOD_DELETE)) {
                        return HTTPConstants.SERIAL_APP_URLENCODED;
                } else {
                        // method is not GET or DELETE so it must be POST or 
PUT.
-                       // TODO confirm ws-desc proposal 19May06 on {http 
method}
                        return HTTPConstants.SERIAL_APP_XML;
                }
        }
@@ -180,25 +190,23 @@
         * @see 
org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions#getHttpQueryParameterSeparator()
         */
        public String getHttpQueryParameterSeparator() {
-               // Implemented per Part 2 spec as at 25May06 but...
-               // TODO monitor ws-desc proposal 19May06 on changing the 
handling of
-               // defaults Part 2
-
+        
                StringAttr separator = (StringAttr) ((WSDLElement) fParent)
                                
.getExtensionAttribute(HTTPConstants.Q_ATTR_QUERY_PARAMETER_SEPARATOR);
                if (separator != null) {
                        return separator.getString();
                }
+        
+        //As per Part 2, 6.7.2.2.1 Construction of the query string, the
+        //default is Binding {http query parameter separator default}.
 
                Binding binding = (Binding) ((BindingOperation) 
fParent).getParent();
 
                HTTPBindingExtensions httpBindExts = (HTTPBindingExtensions) 
binding
                                
.getComponentExtensionsForNamespace(HTTPConstants.NS_URI_HTTP);
 
-               // {http query parameter separator default} is a REQUIRED 
extension
-               // property
-               // so HTTPBindingExtensions must be present (i.e. no need to 
check for
-               // null).
+               //No need for null check on httpBindExts because it has REQUIRED
+        //properties, so it must be present.
                return httpBindExts.getHttpQueryParameterSeparatorDefault();
        }
 

Modified: 
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingFaultExtensionsTest.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingFaultExtensionsTest.java?rev=411632&r1=411631&r2=411632&view=diff
==============================================================================
--- 
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingFaultExtensionsTest.java
 (original)
+++ 
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingFaultExtensionsTest.java
 Sun Jun  4 18:06:03 2006
@@ -132,10 +132,11 @@
      * Test that the REQUIRED property {http error status code} defaults to 
"#any"
      * when the whttp:code attribute is omitted from the WSDL.
      * <p>
+     * TODO {http transfer coding} defaults to null, pending clarification
+     * on whether it should default to Binding {http transfer coding default}. 
+     * If this is confirmed, then apply the following test too.
      * Test that the OPTIONAL property {http transfer coding} defaults to the 
Binding's
      * {http transfer coding default} property when whttp:transferCoding is 
omitted.
-     * TODO {http transfer coding} defaults to null per the spec, pending 
confirmation via 
-     * ws-desc of the assumption that it should default to Binding {http 
transfer coding default}.
      */
     public void testHttpPropertyDefaults()
     {
@@ -151,29 +152,30 @@
                 HTTPErrorStatusCode.ANY,
                 actual);
 
-        /* See above TODO about getting assumption being confirm in the spec 
first.
+        /* See above TODO about fixing the spec before using this test.
          * 
-        //get the http transfer coding default from the parent Binding
-        Binding binding = (Binding)bindFault.getParent();
-        HTTPBindingExtensions httpBindExts =  (HTTPBindingExtensions)binding
-            
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP);
-        assertNotNull("The parent Binding does not contain an 
HTTPBindingExtensions object.",
-                httpBindExts);
-        String tfrCodingDef = httpBindExts.getHttpTransferCodingDefault();
-        
-        //check that the http transfer coding is equal to the default obtained 
from the parent
-        assertEquals("The {http transfer coding} does not match the {http 
transfer coding default}.",
-                tfrCodingDef,
-                httpBindFaultExts.getHttpTransferCoding());
-        
-        //check that the transfer coding is "chunked" (the default in the 
parent)
-        assertEquals("The {http transfer coding} is not 'chunked' as 
expected.",
-                "chunked",
-                httpBindFaultExts.getHttpTransferCoding());
+         * //get the http transfer coding default from the parent Binding
+         * Binding binding = (Binding)bindFault.getParent();
+         * HTTPBindingExtensions httpBindExts =  (HTTPBindingExtensions)binding
+         *     
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP);
+         * assertNotNull("The parent Binding does not contain an 
HTTPBindingExtensions object.",
+         *         httpBindExts);
+         * String tfrCodingDef = httpBindExts.getHttpTransferCodingDefault();
+         * 
+         * //check that the http transfer coding is equal to the default 
obtained from the parent
+         * assertEquals("The {http transfer coding} does not match the {http 
transfer coding default}.",
+         *         tfrCodingDef,
+         *         httpBindFaultExts.getHttpTransferCoding());
+         * 
+         * //check that the transfer coding is "chunked" (the default in the 
parent)
+         * assertEquals("The {http transfer coding} is not 'chunked' as 
expected.",
+         *         "chunked",
+         *         httpBindFaultExts.getHttpTransferCoding());
          */
         
+        //TODO replace the following assertNull with the code above, once it's 
confirmed.
         assertNull("The {http transfer coding} is not null as expected.",
-                httpBindFaultExts.getHttpTransferCoding());  //TODO replace 
with above code, once confirmed.
+                httpBindFaultExts.getHttpTransferCoding());  
     }
     
     /**

Modified: 
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingExtensions.wsdl
URL: 
http://svn.apache.org/viewvc/incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingExtensions.wsdl?rev=411632&r1=411631&r2=411632&view=diff
==============================================================================
--- 
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingExtensions.wsdl
 (original)
+++ 
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingExtensions.wsdl
 Sun Jun  4 18:06:03 2006
@@ -15,8 +15,8 @@
  * limitations under the License.
 -->
 <description xmlns="http://www.w3.org/2006/01/wsdl";
-       targetNamespace="http://ws.apache.woden/endpoint";
-       xmlns:tns="http://ws.apache.woden/endpoint";
+       targetNamespace="http://ws.apache.woden";
+       xmlns:tns="http://ws.apache.woden";
        xmlns:xs="http://www.w3.org/2001/XMLSchema";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xmlns:whttp= "http://www.w3.org/2006/01/wsdl/http";

Modified: 
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingFaultExtensions.wsdl
URL: 
http://svn.apache.org/viewvc/incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingFaultExtensions.wsdl?rev=411632&r1=411631&r2=411632&view=diff
==============================================================================
--- 
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingFaultExtensions.wsdl
 (original)
+++ 
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingFaultExtensions.wsdl
 Sun Jun  4 18:06:03 2006
@@ -15,8 +15,8 @@
  * limitations under the License.
 -->
 <description xmlns="http://www.w3.org/2006/01/wsdl";
-       targetNamespace="http://ws.apache.woden/endpoint";
-       xmlns:tns="http://ws.apache.woden/endpoint";
+       targetNamespace="http://ws.apache.woden";
+       xmlns:tns="http://ws.apache.woden";
        xmlns:xs="http://www.w3.org/2001/XMLSchema";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xmlns:whttp= "http://www.w3.org/2006/01/wsdl/http";



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to