cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1055163 - in /cxf/branches/2.3.x-fixes: ./ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/ tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/ tools/wsdlto/test/src/test/resour...
Date Tue, 04 Jan 2011 19:42:29 GMT
Author: dkulp
Date: Tue Jan  4 19:42:28 2011
New Revision: 1055163

URL: http://svn.apache.org/viewvc?rev=1055163&view=rev
Log:
Merged revisions 1055154 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1055154 | dkulp | 2011-01-04 14:33:43 -0500 (Tue, 04 Jan 2011) | 2 lines
  
  [CXF-3231] Check the wsa-action if the soap:body would not allow
  distinguishing the operation.
........

Added:
    cxf/branches/2.3.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_overload.wsdl
      - copied unchanged from r1055154, cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_overload.wsdl
Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
    cxf/branches/2.3.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java?rev=1055163&r1=1055162&r2=1055163&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
(original)
+++ cxf/branches/2.3.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
Tue Jan  4 19:42:28 2011
@@ -21,7 +21,9 @@ package org.apache.cxf.tools.wsdlto.fron
 
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.logging.Logger;
 import javax.xml.namespace.QName;
 
@@ -31,6 +33,7 @@ import org.apache.cxf.service.model.Bind
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
@@ -66,6 +69,7 @@ public class UniqueBodyValidator extends
     private boolean isValidEndpoint(EndpointInfo endpoint) {
         BindingInfo binding = endpoint.getBinding();
         Map<QName, QName> uniqueNames = new HashMap<QName, QName>();
+        Map<QName, Set<String>> actions = new HashMap<QName, Set<String>>();
 
         Collection<BindingOperationInfo> bos = binding.getOperations();
         for (BindingOperationInfo bo : bos) {
@@ -77,7 +81,12 @@ public class UniqueBodyValidator extends
                     continue;
                 }
                 QName mName = part.getElementQName();
+                String action = getWSAAction(op.getInput());
                 QName opName = uniqueNames.get(mName);
+                Set<String> opActions = actions.get(mName);
+                if (opName != null && opActions != null && !opActions.contains(action))
{
+                    opName = null;
+                }
                 if (opName != null) {
                     Message msg = new Message("NON_UNIQUE_BODY", LOG, 
                                               endpoint.getName(), op.getName(), opName, mName);
@@ -85,6 +94,13 @@ public class UniqueBodyValidator extends
                     return false;
                 } else {
                     uniqueNames.put(mName, op.getName());
+                    if (action != null) {
+                        if (opActions == null) {
+                            opActions = new HashSet<String>();
+                            actions.put(mName, opActions);
+                        }
+                        opActions.add(action);
+                    }
                 }
             }
             
@@ -100,4 +116,15 @@ public class UniqueBodyValidator extends
         }
         return true;
     }
+
+    private String getWSAAction(MessageInfo input) {
+        if (input.getExtensionAttributes() != null) {
+            for (Map.Entry<QName, Object> ent : input.getExtensionAttributes().entrySet())
{
+                if ("Action".equals(ent.getKey().getLocalPart())) {
+                    return ent.getValue().toString();
+                }
+            }
+        }
+        return null;
+    }
 }

Modified: cxf/branches/2.3.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=1055163&r1=1055162&r2=1055163&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/branches/2.3.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Tue Jan  4 19:42:28 2011
@@ -1153,4 +1153,14 @@ public class CodeGenBugTest extends Abst
         assertTrue(contents.contains("<Loginresponse> loginResponse"));
     }
 
+    @Test
+    public void testOverloadWithAction() throws Exception {
+        String[] args = new String[] {"-d", output.getCanonicalPath(),
+            getLocation("/wsdl2java_wsdl/hello_world_overload.wsdl")};
+        WSDLToJava.main(args);
+        
+        assertNotNull(output);
+        File f = new File(output, "org/apache/cxf/w2j/hello_world_soap_http/SayHi.java");
+        assertTrue(f.exists());
+    }
 }



Mime
View raw message