You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2007/01/23 00:54:05 UTC

svn commit: r498856 - in /incubator/woden/trunk/java: src/org/apache/woden/internal/wsdl20/extensions/soap/ src/org/apache/woden/wsdl20/extensions/soap/ test/org/apache/woden/wsdl20/extensions/soap/ test/org/apache/woden/wsdl20/extensions/soap/resources/

Author: jkaputin
Date: Mon Jan 22 15:54:03 2007
New Revision: 498856

URL: http://svn.apache.org/viewvc?view=rev&rev=498856
Log:
WODEN-129 Added http query parameter separator default 
to SOAP binding extensions and http query parameter
separator to the SOAP binding operation extensions
(i.e. applicable when protocol is HTTP). Added
junit testcases too.

Modified:
    incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingExtensionsImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingOperationExtensionsImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensions.java
    incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensions.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensionsTest.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensionsTest.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingOperationExtensions.wsdl

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingExtensionsImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingExtensionsImpl.java?view=diff&rev=498856&r1=498855&r2=498856
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingExtensionsImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingExtensionsImpl.java Mon Jan 22 15:54:03 2007
@@ -19,7 +19,6 @@
 
 import org.apache.woden.internal.wsdl20.extensions.ComponentExtensionsImpl;
 import org.apache.woden.internal.wsdl20.extensions.http.HTTPConstants;
-import org.apache.woden.wsdl20.Binding;
 import org.apache.woden.wsdl20.extensions.ExtensionElement;
 import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions;
 import org.apache.woden.wsdl20.extensions.soap.SOAPModule;
@@ -81,6 +80,29 @@
         return soapMods;
     }
     
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions#getHttpQueryParameterSeparatorDefault()
+     */
+    public String getHttpQueryParameterSeparatorDefault() 
+    {
+        URI protocol = getSoapUnderlyingProtocol();
+        if(protocol == null) {
+            return null;
+        }
+        
+        if( ("1.2".equals(getSoapVersion()) && protocol.toString().equals(SOAPConstants.URI_SOAP12_HTTP)) ||
+            ("1.1".equals(getSoapVersion()) && protocol.toString().equals(SOAPConstants.URI_SOAP11_HTTP)) )
+        {
+            StringAttr qpsDef = (StringAttr) ((WSDLElement)fParent)
+                .getExtensionAttribute(HTTPConstants.Q_ATTR_QUERY_PARAMETER_SEPARATOR_DEFAULT);
+            return qpsDef != null ? qpsDef.getString() : HTTPConstants.QUERY_SEP_AMPERSAND;
+        } 
+        else
+        {
+            return null;
+        }
+    }
+
     /* (non-Javadoc)
      * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions#isHttpCookies()
      */

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingOperationExtensionsImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingOperationExtensionsImpl.java?view=diff&rev=498856&r1=498855&r2=498856
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingOperationExtensionsImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPBindingOperationExtensionsImpl.java Mon Jan 22 15:54:03 2007
@@ -106,6 +106,35 @@
     /*
      * (non-Javadoc)
      * 
+     * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions#getHttpQueryParameterSeparator()
+     */
+    public String getHttpQueryParameterSeparator() {
+        
+        Binding binding = (Binding) ((NestedComponent)fParent).getParent();
+        SOAPBindingExtensions soapBindExt = (SOAPBindingExtensions)binding
+           .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+        String version = soapBindExt.getSoapVersion();
+        URI protocol = soapBindExt.getSoapUnderlyingProtocol();
+        if(protocol == null) {
+            return null;
+        }
+        
+        if( ("1.2".equals(version) && protocol.toString().equals(SOAPConstants.URI_SOAP12_HTTP)) ||
+            ("1.1".equals(version) && protocol.toString().equals(SOAPConstants.URI_SOAP11_HTTP)) )
+        {
+            StringAttr separator = (StringAttr) ((WSDLElement) fParent)
+                .getExtensionAttribute(HTTPConstants.Q_ATTR_QUERY_PARAMETER_SEPARATOR);
+            return separator != null ? separator.getString() : null;
+        } 
+        else 
+        {
+            return null;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions#getHttpTransferCodingDefault()
      */
     public String getHttpTransferCodingDefault() {

Modified: incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensions.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensions.java?view=diff&rev=498856&r1=498855&r2=498856
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensions.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensions.java Mon Jan 22 15:54:03 2007
@@ -44,8 +44,31 @@
     
     public SOAPModule[] getSoapModules();
     
+    /**
+     * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the
+     * {http query parameter separator default} extension property represented by the 
+     * whttp:queryParameterSeparatorDefault extension attribute , otherwise null. 
+     * 
+     * @return String the {http query parameter separator default} extension property
+     */
+    public String getHttpQueryParameterSeparatorDefault();
+    
+    /**
+     * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the
+     * {http cookies} extension property represented by the 
+     * whttp:cookies extension attribute , otherwise null. 
+     * 
+     * @return String the {http cookies} extension property
+     */
     public Boolean isHttpCookies();
     
+    /**
+     * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the
+     * {http transfer coding default} extension property represented by the 
+     * whttp:transferCodingDefault extension attribute , otherwise null. 
+     * 
+     * @return String the {http transfer coding default} extension property
+     */
     public String getHttpTransferCodingDefault();
     
 }

Modified: incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensions.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensions.java?view=diff&rev=498856&r1=498855&r2=498856
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensions.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensions.java Mon Jan 22 15:54:03 2007
@@ -52,12 +52,29 @@
     public SOAPModule[] getSoapModules();
 
     /**
-     * @return HTTPLocation the {http location} property, represented by the whttp:location extension attribute
+     * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the
+     * {http location} extension property represented by the 
+     * whttp:location extension attribute , otherwise null. 
+     * 
+     * @return HTTPLocation the {http location} extension property
      */
     public HTTPLocation getHttpLocation();
     
     /**
-     * @return String the {http transfer coding default}, represented by the whttp:transferCodingDefault extension attribute
+     * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the
+     * {http query parameter separator} extension property represented by the 
+     * whttp:queryParameterSeparator extension attribute , otherwise null. 
+     * 
+     * @return String the {http query parameter separator} extension property
+     */
+    public String getHttpQueryParameterSeparator();
+    
+    /**
+     * If the SOAP version is "1.1" or "1.2" and the underlying protocol is HTTP, returns the
+     * {http transfer coding default} extension property represented by the 
+     * whttp:transferCodingDefault extension attribute , otherwise null. 
+     * 
+     * @return String the {http transfer coding default} extension property
      */
     public String getHttpTransferCodingDefault();
     

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensionsTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensionsTest.java?view=diff&rev=498856&r1=498855&r2=498856
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensionsTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensionsTest.java Mon Jan 22 15:54:03 2007
@@ -43,8 +43,9 @@
     private WSDLReader fReader = null;
     private ErrorHandler fHandler = null;
     private DescriptionElement fDescElem = null;
-    
     private SOAPBindingExtensions fSoapBindExts = null;
+    private SOAPBindingExtensions fSoapBind2Exts = null;
+    
     private String fWsdlPath = "org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl";
     
     public static Test suite()
@@ -72,6 +73,12 @@
         
         fSoapBindExts = (SOAPBindingExtensions)binding.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
         assertNotNull("The Binding does not contain a SOAPBindingExtensions object.");
+        
+        Binding binding2 = descComp.getBindings()[1];
+        assertNotNull("The Description does not contain a second Binding.", binding2);
+        
+        fSoapBind2Exts = (SOAPBindingExtensions)binding2.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+        assertNotNull("The second Binding does not contain a SOAPBindingExtensions object.");
     }
     
     /**
@@ -96,7 +103,7 @@
         URI actual = fSoapBindExts.getSoapUnderlyingProtocol();
         assertNotNull("The value for soap underlying protocol was null", actual);
         
-        URI expected = URI.create("http://www.w3.org/2003/05/soap/bindings/HTTP");
+        URI expected = URI.create("http://www.w3.org/2003/05/soap/bindings/HTTP/");
         assertEquals("Unexpected value for soap underlying protocol.", 
                 expected,
                 actual);
@@ -127,6 +134,26 @@
         assertEquals("Unexpected number of SOAPModule objects.",
                 2,
                 actual.length);
+    }
+    
+    /**
+     * Test that the {http query parameter separator default} property return by the
+     * <code>getHttpQueryParameterSeparatorDefault</code> method matches the value
+     * parsed from the WSDL or that it defaults to ampersand "&" if omitted from the WSDL.
+     */
+    public void testGetHttpQueryParameterSeparatorDefault()
+    {
+        String actual = fSoapBindExts.getHttpQueryParameterSeparatorDefault();
+        assertNotNull("The value for http query parameter separator default was null", actual);
+        assertEquals("Unexpected value for http query parameter separator default.", 
+                "$",
+                actual);
+        
+        String actual2 = fSoapBind2Exts.getHttpQueryParameterSeparatorDefault();
+        assertNotNull("The default value for http query parameter separator default was null", actual2);
+        assertEquals("Unexpected default value for http query parameter separator default.", 
+                "&",
+                actual2);
     }
 
 }

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensionsTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensionsTest.java?view=diff&rev=498856&r1=498855&r2=498856
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensionsTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingOperationExtensionsTest.java Mon Jan 22 15:54:03 2007
@@ -44,8 +44,9 @@
     private WSDLReader fReader = null;
     private ErrorHandler fHandler = null;
     private DescriptionElement fDescElem = null;
-    
     private BindingOperation fBindOper = null;
+    private BindingOperation fBind2Oper = null;
+    
     private String fWsdlPath = "org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingOperationExtensions.wsdl";
     
     public static Test suite()
@@ -76,6 +77,12 @@
         assertNotNull("The Description does not contain a Binding.", binding);
         fBindOper = binding.getBindingOperations()[0];
         assertNotNull("The Binding does not a BindingOperation.", fBindOper);
+        
+        Binding binding2 = descComp.getBindings()[1];
+        assertNotNull("The Description does not contain a second Binding.", binding2);
+        
+        fBind2Oper = binding2.getBindingOperations()[0];
+        assertNotNull("The second Binding does not contain a BindingOperation.");
     }
 
     /*
@@ -125,4 +132,25 @@
         assertEquals("Unexpected number of SOAPModule objects.", 1, actual.length);
     }
 
+    /**
+     * Test that the {http query parameter separator} property returned by the 
+     * <code>getHttpParameterSeparator</code> method method matches the value
+     * parsed from the WSDL or that it defaults to null if omitted from the WSDL.
+     */
+    public void testGetHttpQueryParameterSeparator()
+    {
+        SOAPBindingOperationExtensions soapBindOperExts = 
+            (SOAPBindingOperationExtensions) fBindOper.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+        String actual = soapBindOperExts.getHttpQueryParameterSeparator();
+        
+        assertNotNull("The SOAPBindingOperationExtensions did not return a value for {http query parameter separator}.", actual);
+        assertEquals("Unexpected value for http query parameter separator.", "$", actual);
+        
+        SOAPBindingOperationExtensions soapBind2OperExts = 
+            (SOAPBindingOperationExtensions) fBind2Oper.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+        String actual2 = soapBind2OperExts.getHttpQueryParameterSeparator();
+        
+        assertNull("Non-null value for http query parameter separator.", actual2);
+        
+    }
 }

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl?view=diff&rev=498856&r1=498855&r2=498856
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl Mon Jan 22 15:54:03 2007
@@ -20,6 +20,7 @@
 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:wsoap= "http://www.w3.org/2006/01/wsdl/soap"
+    xmlns:whttp= "http://www.w3.org/2006/01/wsdl/http"
 	xsi:schemaLocation=
 	    "http://www.w3.org/2006/01/wsdl http://www.w3.org/2006/01/wsdl/wsdl20.xsd 
 	    http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd">
@@ -36,8 +37,12 @@
 	  interface="tns:interface1"
 	  type="http://www.w3.org/2006/01/wsdl/soap"
 	  wsoap:version="1.2"
-	  wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"
-	  wsoap:mepDefault="http://www.w3.org/2003/05/soap/mep/request-response">
+	  wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"
+	  wsoap:mepDefault="http://www.w3.org/2003/05/soap/mep/request-response"
+	  whttp:queryParameterSeparatorDefault="$">
+	  <documentation>
+	     {http query parameter separator default} should be "$" if whttp:queryParameterSeparatorDefault is "$"
+	  </documentation>
 
         <wsoap:module ref="urn:ccc" required="true">
             <documentation>A soap module the processor is required to handle</documentation>
@@ -48,6 +53,19 @@
         </wsoap:module>
         
 	</binding>
+	
+	
+	<binding name="binding2"
+	  type="http://www.w3.org/2006/01/wsdl/soap"
+	  wsoap:version="1.1"
+	  wsoap:protocol="http://www.w3.org/2006/01/soap11/bindings/HTTP/">
+	  
+	  <documentation>
+	     {http query parameter separator default} should default to ampersand if whttp:queryParameterSeparatorDefault is omitted
+	  </documentation>
+
+	</binding>
+	
 	
 	<service name="service1" interface="tns:interface1" />
 	

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingOperationExtensions.wsdl
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingOperationExtensions.wsdl?view=diff&rev=498856&r1=498855&r2=498856
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingOperationExtensions.wsdl (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingOperationExtensions.wsdl Mon Jan 22 15:54:03 2007
@@ -21,6 +21,7 @@
 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:wsoap= "http://www.w3.org/2006/01/wsdl/soap"
     xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope"
+    xmlns:whttp= "http://www.w3.org/2006/01/wsdl/http"
     xmlns:ghns = "urn:ghns"
 	xsi:schemaLocation=
 	    "http://www.w3.org/2006/01/wsdl http://www.w3.org/2006/01/wsdl/wsdl20.xsd 
@@ -34,13 +35,34 @@
 	
 	<binding name="binding1"
 	  interface="tns:interface1"
-	  type="http://www.w3.org/2006/01/wsdl/soap">
+	  type="http://www.w3.org/2006/01/wsdl/soap"
+	  wsoap:version="1.2"
+	  wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/">
+
+        <operation
+          wsoap:mep="urn:mep"
+          wsoap:action="urn:action"
+	      whttp:queryParameterSeparator="$">
+            <documentation>Test that mep and action attributes are parsed correctly.</documentation>
+            <documentation>Test that 1 SOAPModule object is parsed.</documentation>
+            <documentation>Test that query paramater separator is parsed correctly.</documentation>
+            <wsoap:module ref="urn:ccc" required="true" />
+        </operation>
+        
+	</binding>
+	
+	<binding name="binding2"
+	  interface="tns:interface1"
+	  type="http://www.w3.org/2006/01/wsdl/soap"
+	  wsoap:version="1.1"
+	  wsoap:protocol="http://www.w3.org/2006/01/soap11/bindings/HTTP/">
 
         <operation
           wsoap:mep="urn:mep"
           wsoap:action="urn:action">
             <documentation>Test that mep and action attributes are parsed correctly.</documentation>
             <documentation>Test that 1 SOAPModule object is parsed.</documentation>
+            <documentation>Test that query paramater separator defaults to null if omitted from the WSDL.</documentation>
             <wsoap:module ref="urn:ccc" required="true" />
         </operation>
         



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