You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2010/08/16 18:26:27 UTC

svn commit: r986015 - in /cxf/trunk/tools/wsdlto: frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/ test/src/test/resources/wsdl2java_wsdl/cxf2944/

Author: ema
Date: Mon Aug 16 16:26:26 2010
New Revision: 986015

URL: http://svn.apache.org/viewvc?rev=986015&view=rev
Log:
[CXF-2944]:Get the targetNamespace value from reference element namespace in @WebResult

Added:
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2944/
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2944/cxf2944.wsdl
Modified:
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.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/processor/internal/ParameterProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?rev=986015&r1=986014&r2=986015&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java (original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java Mon Aug 16 16:26:26 2010
@@ -439,7 +439,7 @@ public class ParameterProcessor extends 
             }
             if (!sameWrapperChild) {
                 JavaReturn jreturn = getReturnFromQName(outElement, outputPart);
-                if (!qualified) {
+                if (!qualified && !this.isRefElement(outputPart, outElement)) {
                     jreturn.setTargetNamespace("");
                 }
                 method.setReturn(jreturn);

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=986015&r1=986014&r2=986015&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 Mon Aug 16 16:26:26 2010
@@ -28,6 +28,7 @@ import java.util.Arrays;
 import java.util.List;
 
 import javax.jws.WebParam;
+import javax.jws.WebResult;
 import javax.jws.WebService;
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebFault;
@@ -54,6 +55,19 @@ import org.junit.Test;
 public class CodeGenBugTest extends AbstractCodeGenTest {
  
     @Test
+    public void testCXF2944() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, 
+                getLocation("/wsdl2java_wsdl/cxf2944/cxf2944.wsdl"));
+        env.put(ToolConstants.CFG_ALLOW_ELEMENT_REFS, "true");
+        processor.setContext(env);
+        processor.execute();
+        Class<?> clz = classLoader.loadClass("org.apache.cxf.tools.fortest.cxf2944.WebResultService");
+        WebResult webResult = AnnotationUtil.getWebResult(clz.getMethods()[0]);
+        assertEquals("hello/name", webResult.targetNamespace());
+        assertEquals("name", webResult.name());      
+    }
+    
+    @Test
     public void testCXF2935() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, 
                 getLocation("/wsdl2java_wsdl/cxf2935/webservice.wsdl"));

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2944/cxf2944.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2944/cxf2944.wsdl?rev=986015&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2944/cxf2944.wsdl (added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2944/cxf2944.wsdl Mon Aug 16 16:26:26 2010
@@ -0,0 +1,74 @@
+<?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 name="WebResultServiceService" targetNamespace="http://cxf2944.fortest.tools.cxf.apache.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://cxf2944.fortest.tools.cxf.apache.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+  <wsdl:types>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="hello/name" xmlns:tns="http://cxf2944.fortest.tools.cxf.apache.org/" elementFormDefault="unqualified" targetNamespace="http://cxf2944.fortest.tools.cxf.apache.org/" version="1.0">
+<xs:import namespace="hello/name"/>
+<xs:element name="helloString" type="tns:helloString"/>
+<xs:element name="helloStringResponse" type="tns:helloStringResponse"/>
+<xs:complexType name="helloString">
+    <xs:sequence>
+      <xs:element name="arg0" type="xs:int"/>
+    </xs:sequence>
+  </xs:complexType>
+<xs:complexType name="helloStringResponse">
+    <xs:sequence>
+      <xs:element minOccurs="0" ref="ns1:name"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="hello/name" version="1.0">
+<xs:element name="name" type="xs:string"/>
+</xs:schema>
+  </wsdl:types>
+  <wsdl:message name="helloString">
+    <wsdl:part name="parameters" element="tns:helloString">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="helloStringResponse">
+    <wsdl:part name="parameters" element="tns:helloStringResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="WebResultService">
+    <wsdl:operation name="helloString">
+      <wsdl:input name="helloString" message="tns:helloString">
+    </wsdl:input>
+      <wsdl:output name="helloStringResponse" message="tns:helloStringResponse">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="WebResultServiceServiceSoapBinding" type="tns:WebResultService">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="helloString">
+      <soap:operation soapAction="urn:HelloString" style="document"/>
+      <wsdl:input name="helloString">
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="helloStringResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="WebResultServiceService">
+    <wsdl:port name="WebResultServicePort" binding="tns:WebResultServiceServiceSoapBinding">
+      <soap:address location="http://localhost:9090/WebResultServicePort"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>