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 ng...@apache.org on 2006/12/04 20:55:02 UTC

svn commit: r482323 - in /webservices/axis2/trunk/java/modules/jaxws: src/org/apache/axis2/jaxws/description/ src/org/apache/axis2/jaxws/description/impl/ src/org/apache/axis2/jaxws/message/ test-resources/wsdl/ test/org/apache/axis2/jaxws/proxy/soap12...

Author: ngallardo
Date: Mon Dec  4 11:55:01 2006
New Revision: 482323

URL: http://svn.apache.org/viewvc?view=rev&rev=482323
Log:
AXIS2-1796

Changed the implementation slightly so that it's reading the namespace of the binding extensibility
element rather than the "transport" attribute.  This is in line with what the WSDL 1.1 SOAP 1.2 
binding specification defines.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java
    webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-JAXWS.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Binding-JAXWS.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Echo.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/SOAP12Echo.wsdl

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java?view=diff&rev=482323&r1=482322&r2=482323
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java Mon Dec  4 11:55:01 2006
@@ -20,9 +20,7 @@
 
 import javax.wsdl.Binding;
 import javax.wsdl.Port;
-import javax.wsdl.PortType;
 import javax.wsdl.Service;
-import javax.wsdl.extensions.ExtensibilityElement;
 import javax.xml.namespace.QName;
 
 import org.apache.axis2.jaxws.util.Constants;
@@ -35,10 +33,22 @@
     public static final QName SOAP_12_ADDRESS_ELEMENT = new QName(Constants.URI_WSDL_SOAP12, "address");
     
     public Service getWSDLService();
+    
     public Port getWSDLPort();
+    
     public Binding getWSDLBinding();
+
+    /**
+     * Returns the namespace for the specific wsdl:binding extensibility element.
+     * Typically, this is the <soap:binding> element that defines either a SOAP 1.1
+     * or a SOAP 1.2 binding.
+     * 
+     * @return
+     */
     public String getWSDLBindingType();
+    
     public String getWSDLSOAPAddress();
+    
     /**
      * Is the WSDL definition fully specified for the endpoint (WSDL 1.1 port)
      * represented by this EndpointDescription.  If the WSDL is Partial, that means

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=482323&r1=482322&r2=482323
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Mon Dec  4 11:55:01 2006
@@ -1128,17 +1128,23 @@
         String wsdlBindingType = null;
         Binding wsdlBinding = getWSDLBinding();
         if (wsdlBinding != null) {
+            // If a WSDL binding was found, we need to find the proper extensibility
+            // element and return the namespace.  The namespace will be different
+            // for SOAP 1.1 vs. SOAP 1.2 bindings.
+            // TODO: What do we do if no extensibility element exists?
             List<ExtensibilityElement> elements = wsdlBinding.getExtensibilityElements();
             Iterator<ExtensibilityElement> itr = elements.iterator();
             while (itr.hasNext()) {
                 ExtensibilityElement e = itr.next();
                 if (javax.wsdl.extensions.soap.SOAPBinding.class.isAssignableFrom(e.getClass())) {
                     javax.wsdl.extensions.soap.SOAPBinding soapBnd = (javax.wsdl.extensions.soap.SOAPBinding) e;
-                    wsdlBindingType = soapBnd.getTransportURI();
+                    wsdlBindingType = soapBnd.getElementType().getNamespaceURI();
+                    return wsdlBindingType;
                 }
                 else if (SOAP12Binding.class.isAssignableFrom(e.getClass())) {
                     SOAP12Binding soapBnd = (SOAP12Binding) e;
-                    wsdlBindingType = soapBnd.getTransportURI();
+                    wsdlBindingType = soapBnd.getElementType().getNamespaceURI();
+                    return wsdlBindingType;
                 }
             }
         }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java?view=diff&rev=482323&r1=482322&r2=482323
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java Mon Dec  4 11:55:01 2006
@@ -1,18 +1,20 @@
 /*
- * Copyright 2004,2005 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package org.apache.axis2.jaxws.message;
 
@@ -20,6 +22,8 @@
 
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Protocol
@@ -29,9 +33,12 @@
 public enum Protocol {
 	soap11, soap12, rest, unknown;
     
-    // WS-I Basic Profile 1.1 specifies a different value for the SOAP 1.1 HTTP
-    // binding than the one specified in JAX-WS, section 10.4.1
-    private static final String SOAP11HTTP_WSI_BINDING = "http://schemas.xmlsoap.org/soap/http";
+	private static final Log log = LogFactory.getLog(Protocol.class);
+    
+    // These namespaces are used in the WSDL document to indentify a 
+    // SOAP 1.1 vs. a SOAP 1.2 binding
+    private static final String SOAP11_WSDL_BINDING = "http://schemas.xmlsoap.org/wsdl/soap";
+    private static final String SOAP12_WSDL_BINDING = "http://schemas.xmlsoap.org/wsdl/soap12";
     
     /**
      * Return the right value for the Protocol based on the binding
@@ -41,18 +48,44 @@
      * @return
      */
     public static Protocol getProtocolForBinding(String url) throws MessageException {
-        System.out.println(">> Looking up binding [" + url + "]");
-        if (url.equals(Protocol.SOAP11HTTP_WSI_BINDING) ||
-            url.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
-        	url.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)) {
+        boolean debug = log.isDebugEnabled();
+        if (debug) {
+            log.debug("Configuring message protocol for binding [" + url + "]");
+        }
+        
+        if (namespaceEquals(Protocol.SOAP11_WSDL_BINDING, url) || 
+            namespaceEquals(SOAPBinding.SOAP11HTTP_BINDING, url) ||
+            namespaceEquals(SOAPBinding.SOAP11HTTP_MTOM_BINDING, url)) {
+            if (debug) {
+                log.debug("SOAP 1.1 protocol configured for message");
+            }
             return Protocol.soap11;
         }
-        else if (url.equals(SOAPBinding.SOAP12HTTP_BINDING) ||
-        		 url.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
+        else if (namespaceEquals(Protocol.SOAP12_WSDL_BINDING, url) ||
+                 namespaceEquals(SOAPBinding.SOAP12HTTP_BINDING, url) ||
+                 namespaceEquals(SOAPBinding.SOAP12HTTP_MTOM_BINDING, url)) {
+            if (debug) {
+                log.debug("SOAP 1.2 protocol configured for message");
+            }
             return Protocol.soap12;
         }
         else {
             throw ExceptionFactory.makeMessageException(Messages.getMessage("protoNotFound00", url));
         }
+    }
+    
+    /*
+     * Check to see if the two strings (namespaces) passed in are the same, but
+     * also accounts for any trailing "/" characters in the string.
+     */
+    private static boolean namespaceEquals(String target, String input) {
+        if (target.equals(input)) {
+            return true;
+        }
+        else if ((target + "/").equals(input)) {
+            return true;
+        }
+        
+        return false;            
     }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-JAXWS.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-JAXWS.wsdl?view=diff&rev=482323&r1=482322&r2=482323
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-JAXWS.wsdl (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-JAXWS.wsdl Mon Dec  4 11:55:01 2006
@@ -45,7 +45,7 @@
    </portType>
 
    <binding name="EchoBinding" type="tns:Echo">
-      <soap:binding style="document" transport="http://schemas.xmlsoap.org/wsdl/soap/http"/>
+      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
       <operation name="echo">
          <soap:operation soapAction=""/>
          <input>

Modified: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Binding-JAXWS.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Binding-JAXWS.wsdl?view=diff&rev=482323&r1=482322&r2=482323
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Binding-JAXWS.wsdl (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Binding-JAXWS.wsdl Mon Dec  4 11:55:01 2006
@@ -3,7 +3,7 @@
       xmlns:tns="http://jaxws.axis2.apache.org/bindingtest/soap12"
       xmlns="http://schemas.xmlsoap.org/wsdl/" 
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/">
 
    <types>
       <xsd:schema targetNamespace="http://jaxws.axis2.apache.org/bindingtest/soap12"
@@ -45,7 +45,7 @@
    </portType>
 
    <binding name="EchoBinding" type="tns:Echo">
-      <soap:binding style="document" transport="http://www.w3.org/2003/05/soap/bindings/HTTP/"/>
+      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
       <operation name="echo">
          <soap:operation soapAction=""/>
          <input>

Modified: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Echo.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Echo.wsdl?view=diff&rev=482323&r1=482322&r2=482323
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Echo.wsdl (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Echo.wsdl Mon Dec  4 11:55:01 2006
@@ -3,7 +3,7 @@
       xmlns:tns="http://jaxws.axis2.apache.org/proxy/soap12"
       xmlns="http://schemas.xmlsoap.org/wsdl/" 
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/">
 
    <types>
       <xsd:schema targetNamespace="http://jaxws.axis2.apache.org/proxy/soap12"
@@ -45,7 +45,7 @@
    </portType>
 
    <binding name="EchoBinding" type="tns:Echo">
-      <soap:binding style="document" transport="http://www.w3.org/2003/05/soap/bindings/HTTP/"/>
+      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
       <operation name="echo">
          <soap:operation soapAction=""/>
          <input>

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/SOAP12Echo.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/SOAP12Echo.wsdl?view=diff&rev=482323&r1=482322&r2=482323
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/SOAP12Echo.wsdl (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/SOAP12Echo.wsdl Mon Dec  4 11:55:01 2006
@@ -3,7 +3,7 @@
       xmlns:tns="http://jaxws.axis2.apache.org/proxy/soap12"
       xmlns="http://schemas.xmlsoap.org/wsdl/" 
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/">
 
    <types>
       <xsd:schema targetNamespace="http://jaxws.axis2.apache.org/proxy/soap12"
@@ -45,7 +45,7 @@
    </portType>
 
    <binding name="EchoBinding" type="tns:Echo">
-      <soap:binding style="document" transport="http://www.w3.org/2003/05/soap/bindings/HTTP/"/>
+      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
       <operation name="echo">
          <soap:operation soapAction=""/>
          <input>



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