cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r986092 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ tools/javato/ws/src/test/java/org/apache/cxf/too...
Date Mon, 16 Aug 2010 18:41:32 GMT
Author: dkulp
Date: Mon Aug 16 18:41:32 2010
New Revision: 986092

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

........
  r986022 | ema | 2010-08-16 12:30:08 -0400 (Mon, 16 Aug 2010) | 1 line
  
  [CXF-2941]:Get the namespace value from reference element in @XmlElement of response wrapper
bean
........

Added:
    cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2941/
      - copied from r986022, cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2941/
    cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2941/WebResultService.java
      - copied unchanged from r986022, cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2941/WebResultService.java
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
    cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java

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

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?rev=986092&r1=986091&r2=986092&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
Mon Aug 16 18:41:32 2010
@@ -433,11 +433,7 @@ public class JaxWsServiceConfiguration e
             String tns = null;
             String local = null;
             if (webResult != null) {
-                //if it's a "wrapped" thing, the WebResult namespace is irrelevant
-                //as the generated element has to be in the namespace of the wrapper type
-                if (webResult.header() || !op.isUnwrapped()) {
-                    tns = webResult.targetNamespace();
-                }
+                tns = webResult.targetNamespace();
                 local = webResult.name();
             }
             if (tns == null || tns.length() == 0) {

Modified: cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java?rev=986092&r1=986091&r2=986092&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
Mon Aug 16 18:41:32 2010
@@ -27,6 +27,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import javax.jws.WebParam;
+import javax.jws.WebResult;
 import javax.xml.ws.Holder;
 
 import org.apache.cxf.common.util.CollectionUtils;
@@ -75,9 +76,17 @@ public final class ResponseWrapper exten
             return fields;
         }
         MessagePartInfo part = message.getMessageParts().get(0);
-
+        
         field.setName(part.getName().getLocalPart());
-
+        field.setTargetNamespace(part.getName().getNamespaceURI());
+               
+        if (method.getAnnotation(WebResult.class) == null 
+            && method.getAnnotation(javax.xml.ws.ResponseWrapper.class) == null
+            || method.getAnnotation(WebResult.class) != null 
+            && method.getAnnotation(WebResult.class).targetNamespace().equals(""))
{
+            field.setTargetNamespace("");   
+        }
+        
         boolean hasReturnType = false;
 
         if (!returnType.isAssignableFrom(void.class)) {
@@ -86,8 +95,6 @@ public final class ResponseWrapper exten
             List<Annotation> jaxbAnns = WrapperUtil.getJaxbAnnotations(method);
             field.setType(type);
             field.setJaxbAnnotations(jaxbAnns.toArray(new Annotation[jaxbAnns.size()]));
-            field.setTargetNamespace("");
-
         }
         fields.add(field);
 

Modified: cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java?rev=986092&r1=986091&r2=986092&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
Mon Aug 16 18:41:32 2010
@@ -79,6 +79,24 @@ public class JavaToWSTest extends ToolTe
         checkStdErr();
         assertTrue("Failed to generate WSDL file", wsdlFile.exists());
     }
+
+    @Test
+    public void testCXF2941() throws Exception {
+        String[] args = new String[] {
+            "-wsdl", "-wrapperbean", 
+            "-s", output.getPath(), 
+            "-o", output.getPath() + "/cxf2941.wsdl", 
+            "org.apache.cxf.tools.fortest.cxf2941.WebResultService"
+        };
+        JavaToWS.main(args);
+        File wrapper = outputFile("org/apache/cxf/tools/fortest/cxf2941/jaxws/HelloResponse.java");
+        String str = FileUtils.getStringFromFile(wrapper);
+        assertTrue("namespace value in annoataion @XmlElement is not correct"
+                   , str.indexOf("hello/name") > -1);
+        assertTrue("name value in annoataion @XmlElement is not correct"
+                   , str.indexOf("\"name\"") > -1);
+    }
+    
     
     @Test
     public void testCXF2934() throws Exception {



Mime
View raw message