cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1522837 - in /cxf/branches/2.6.x-fixes: rt/core/src/main/java/org/apache/cxf/wsdl11/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/ tools/wsdlto/test/src/test/java/org/apa...
Date Fri, 13 Sep 2013 09:46:44 GMT
Author: ay
Date: Fri Sep 13 09:46:43 2013
New Revision: 1522837

URL: http://svn.apache.org/r1522837
Log:
Merged revisions 1522821 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

........
  r1522821 | ay | 2013-09-13 11:00:18 +0200 (Fri, 13 Sep 2013) | 10 lines

  Merged revisions 1522738 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk

  ........
    r1522738 | ay | 2013-09-12 23:48:38 +0200 (Thu, 12 Sep 2013) | 2 lines

    [CXF-5280] wsdl2java may fail to extract the wsma:Action attribute value

  ........

........

Added:
    cxf/branches/2.6.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf5280/
    cxf/branches/2.6.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf5280/hello_world.wsdl
Modified:
    cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
    cxf/branches/2.6.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WSActionAnnotator.java
    cxf/branches/2.6.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java?rev=1522837&r1=1522836&r2=1522837&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
Fri Sep 13 09:46:43 2013
@@ -36,6 +36,7 @@ import javax.wsdl.BindingInput;
 import javax.wsdl.Definition;
 import javax.wsdl.Types;
 import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.AttributeExtensible;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.ExtensionRegistry;
 import javax.wsdl.extensions.mime.MIMEPart;
@@ -114,6 +115,8 @@ public class WSDLManagerImpl implements 
             Class<? extends ExtensibilityElement> clazz = 
                 registry.createExtension(BindingInput.class, header).getClass();
             registry.mapExtensionTypes(MIMEPart.class, header, clazz);
+            // register some known extension attribute types that are not recognized by the
default registry
+            addExtensionAttributeTypes(registry);
         } catch (WSDLException e) {
             throw new BusException(e);
         }
@@ -294,6 +297,22 @@ public class WSDLManagerImpl implements 
         }
     }
 
+    private void addExtensionAttributeTypes(ExtensionRegistry extreg) {
+        // register types that are not of wsdl4j's default attribute type QName
+        QName qn = new QName("http://www.w3.org/2006/05/addressing/wsdl", "Action");
+        extreg.registerExtensionAttributeType(javax.wsdl.Input.class, qn, AttributeExtensible.STRING_TYPE);
+        extreg.registerExtensionAttributeType(javax.wsdl.Output.class, qn, AttributeExtensible.STRING_TYPE);
+        extreg.registerExtensionAttributeType(javax.wsdl.Fault.class, qn, AttributeExtensible.STRING_TYPE);
+        qn = new QName("http://www.w3.org/2007/05/addressing/metadata", "Action"); 
+        extreg.registerExtensionAttributeType(javax.wsdl.Input.class, qn, AttributeExtensible.STRING_TYPE);
+        extreg.registerExtensionAttributeType(javax.wsdl.Output.class, qn, AttributeExtensible.STRING_TYPE);
+        extreg.registerExtensionAttributeType(javax.wsdl.Fault.class, qn, AttributeExtensible.STRING_TYPE);
+        qn = new QName("http://www.w3.org/2005/02/addressing/wsdl", "Action");
+        extreg.registerExtensionAttributeType(javax.wsdl.Input.class, qn, AttributeExtensible.STRING_TYPE);
+        extreg.registerExtensionAttributeType(javax.wsdl.Output.class, qn, AttributeExtensible.STRING_TYPE);
+        extreg.registerExtensionAttributeType(javax.wsdl.Fault.class, qn, AttributeExtensible.STRING_TYPE);
+    }
+    
     public ServiceSchemaInfo getSchemasForDefinition(Definition wsdl) {
         if (disableSchemaCache) {
             return null;

Modified: cxf/branches/2.6.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WSActionAnnotator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WSActionAnnotator.java?rev=1522837&r1=1522836&r2=1522837&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WSActionAnnotator.java
(original)
+++ cxf/branches/2.6.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WSActionAnnotator.java
Fri Sep 13 09:46:43 2013
@@ -53,20 +53,14 @@ public final class WSActionAnnotator imp
     }
     
     private String getAction(AbstractMessageContainer mi) {
-        QName action = (QName)mi.getExtensionAttribute(WSAW_ACTION_QNAME);
+        String action = (String)mi.getExtensionAttribute(WSAW_ACTION_QNAME);
         if (action == null) {
-            action = (QName)mi.getExtensionAttribute(WSAM_ACTION_QNAME);
+            action = (String)mi.getExtensionAttribute(WSAM_ACTION_QNAME);
         }
         if (action == null) {
-            action = (QName)mi.getExtensionAttribute(WSAW_OLD_ACTION_QNAME);
+            action = (String)mi.getExtensionAttribute(WSAW_OLD_ACTION_QNAME);
         }
-        if (action != null) {
-            String s = action.getLocalPart();
-            if (!StringUtils.isEmpty(s)) {
-                return s;
-            }
-        } 
-        return null;
+        return StringUtils.isEmpty(action) ? null : action;
     }
     
     public void annotate(JavaAnnotatable ja) {

Modified: cxf/branches/2.6.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.6.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=1522837&r1=1522836&r2=1522837&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/branches/2.6.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Fri Sep 13 09:46:43 2013
@@ -32,6 +32,7 @@ import javax.jws.WebParam;
 import javax.jws.WebResult;
 import javax.jws.WebService;
 import javax.xml.namespace.QName;
+import javax.xml.ws.Action;
 import javax.xml.ws.WebFault;
 import javax.xml.ws.WebServiceClient;
 
@@ -45,7 +46,6 @@ import org.apache.cxf.tools.wsdlto.Abstr
 import org.apache.cxf.tools.wsdlto.WSDLToJava;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.validator.UniqueBodyValidator;
 import org.apache.cxf.wsdl11.WSDLRuntimeException;
-
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.handler.ResourceHandler;
 
@@ -1194,4 +1194,23 @@ public class CodeGenBugTest extends Abst
             fail("shouldn't get exception");
         }
     }
+
+    @Test
+    public void testCXF5280() throws Exception {
+        env.put(ToolConstants.CFG_ALL, "all");
+        env.put(ToolConstants.CFG_COMPILE, "compile");
+        env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
+        env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf5280/hello_world.wsdl"));
+        processor.setContext(env);
+        processor.execute();
+
+        Class<?> pcls = classLoader.loadClass("org.apache.cxf.w2j.hello_world_soap_http.Greeter");
+        Class<?> acls = classLoader.loadClass("org.apache.cxf.w2j.hello_world_soap_http.types.GreetMe");
+        Method m = pcls.getMethod("greetMe", new Class[] {acls});
+
+        Action actionAnn = AnnotationUtil.getPrivMethodAnnotation(m, Action.class);
+        assertNotNull(actionAnn);
+        assertEquals("http://cxf.apache.org/w2j/hello_world_soap_http/greetMe", actionAnn.input());
+    }
 }

Added: cxf/branches/2.6.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf5280/hello_world.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf5280/hello_world.wsdl?rev=1522837&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf5280/hello_world.wsdl
(added)
+++ cxf/branches/2.6.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf5280/hello_world.wsdl
Fri Sep 13 09:46:43 2013
@@ -0,0 +1,81 @@
+<?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:wswa="http://www.w3.org/2006/05/addressing/wsdl"
+    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    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" elementFormDefault="qualified">
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                        <element name="requestTypeb" type="string"/>
+                        <element name="requestTypec" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <any/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part name="parameters" element="x1:greetMe"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part name="parameters" element="x1:greetMeResponse"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="Greeter">
+        <wsdl:operation name="greetMe" parameterOrder="parameters">
+            <wsdl:input name="greetMeRequest" message="tns:greetMeRequest" 
+                        wswa:Action="http://cxf.apache.org/w2j/hello_world_soap_http/greetMe"/>
+            <wsdl:output name="greetMeResponse" message="tns:greetMeResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="greetMe">
+            <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/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>



Mime
View raw message