cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1055154 - in /cxf/trunk/tools/wsdlto: frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/ test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/ test/src/test/resources/wsdl2java_wsdl/
Date Tue, 04 Jan 2011 19:33:43 GMT
Author: dkulp
Date: Tue Jan  4 19:33:43 2011
New Revision: 1055154

URL: http://svn.apache.org/viewvc?rev=1055154&view=rev
Log:
[CXF-3231] Check the wsa-action if the soap:body would not allow
distinguishing the operation.

Added:
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_overload.wsdl
  (with props)
Modified:
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java?rev=1055154&r1=1055153&r2=1055154&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
Tue Jan  4 19:33:43 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/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=1055154&r1=1055153&r2=1055154&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Tue Jan  4 19:33:43 2011
@@ -1151,4 +1151,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());
+    }
 }

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_overload.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_overload.wsdl?rev=1055154&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_overload.wsdl
(added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_overload.wsdl
Tue Jan  4 19:33:43 2011
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:tns="http://cxf.apache.org/w2j/hello_world_soap_http"
+    xmlns:x1="http://cxf.apache.org/w2j/hello_world_soap_http/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
+    targetNamespace="http://cxf.apache.org/w2j/hello_world_soap_http" name="HelloWorld">
+    <wsdl:types>
+        <schema targetNamespace="http://cxf.apache.org/w2j/hello_world_soap_http/types"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:x1="http://cxf.apache.org/w2j/hello_world_soap_http/types"
elementFormDefault="qualified">
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part name="in" element="x1:sayHi"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part name="out" element="x1:sayHiResponse"/>
+    </wsdl:message>
+    <wsdl:portType name="SayHi">
+        <wsdl:operation name="sayHi">
+            <wsdl:input wsam:Action="http://cxf.apache.org/HelloWorld/SayHi" name="sayHiRequest"
message="tns:sayHiRequest"/>
+            <wsdl:output wsam:Action="http://cxf.apache.org/HelloWorld/SayHiResponse"
name="sayHiResponse" message="tns:sayHiResponse"/>
+        </wsdl:operation>
+        <wsdl:operation name="sayHi2">
+            <wsdl:input wsam:Action="http://cxf.apache.org/HelloWorld/SayHi2" name="sayHiRequest"
message="tns:sayHiRequest"/>
+            <wsdl:output wsam:Action="http://cxf.apache.org/HelloWorld/SayHi2Response"
name="sayHiResponse" message="tns:sayHiResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:SayHi">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="sayHi">
+            <soap:operation style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="sayHi2">
+            <soap:operation style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="SOAPService">
+        <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+            <wswa:UsingAddressing xmlns:wswa="http://www.w3.org/2005/02/addressing/wsdl"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_overload.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_overload.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_overload.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message