cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r984487 - in /cxf/branches/2.2.x-fixes: ./ tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/ tools/javato/ws/src/test/java/org/apache/c...
Date Wed, 11 Aug 2010 17:34:33 GMT
Author: dkulp
Date: Wed Aug 11 17:34:32 2010
New Revision: 984487

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

........
  r984414 | ema | 2010-08-11 10:07:34 -0400 (Wed, 11 Aug 2010) | 1 line
  
  [CXF-2934]:Corrected target namespace in generated wrapper bean
........

Added:
    cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/
      - copied from r984414, cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/
    cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/Address.java
      - copied unchanged from r984414, cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/Address.java
    cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/Employee.java
      - copied unchanged from r984414, cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/Employee.java
    cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/Name.java
      - copied unchanged from r984414, cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/Name.java
    cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/WebParamService.java
      - copied unchanged from r984414, cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/cxf2934/WebParamService.java
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.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/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.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/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.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/RequestWrapper.java?rev=984487&r1=984486&r2=984487&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
Wed Aug 11 17:34:32 2010
@@ -93,15 +93,6 @@ public class RequestWrapper extends Wrap
         return fields;
     }
 
-    private WebParam getWebParamAnnotation(final Annotation[] annotations) {
-        for (Annotation annotation : annotations) {
-            if (annotation instanceof WebParam) {
-                return (WebParam) annotation;
-            }
-        }
-        return null;
-    }
-
     @Override
     public WrapperBeanClass getWrapperBeanClass(final Method method) {
         javax.xml.ws.RequestWrapper reqWrapper = method.getAnnotation(javax.xml.ws.RequestWrapper.class);

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=984487&r1=984486&r2=984487&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
Wed Aug 11 17:34:32 2010
@@ -21,10 +21,14 @@ package org.apache.cxf.tools.java2wsdl.p
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+
 import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.service.model.MessageInfo;
@@ -92,15 +96,23 @@ public final class ResponseWrapper exten
             int idx = hasReturnType ? mpi.getIndex() - 1 : mpi.getIndex();
             if (idx >= 0) {
                 String name = mpi.getName().getLocalPart();
-
                 Type t = paramClasses[idx];
                 String type = getTypeString(t);
-
                 JavaField jf = new JavaField(name, type, "");
                 List<Annotation> jaxbAnns = WrapperUtil.getJaxbAnnotations(method,
idx - 1);
                 jf.setJaxbAnnotations(jaxbAnns.toArray(new Annotation[jaxbAnns.size()]));
-                fields.add(new JavaField(name, type, ""));
-
+                if (t instanceof ParameterizedType) {
+                    ParameterizedType pt = (ParameterizedType)t;
+                    Class c = (Class)pt.getRawType();
+                    if (Holder.class.isAssignableFrom(c)) {
+                        Annotation[][] paramAnnotations = method.getParameterAnnotations();
+                        WebParam wParam = getWebParamAnnotation(paramAnnotations[idx]);
+                        if (wParam != null && !StringUtils.isEmpty(wParam.targetNamespace()))
{
+                            jf.setTargetNamespace(wParam.targetNamespace());
+                        }
+                    }                   
+                }
+                fields.add(jf);
             }
         }
 
@@ -128,5 +140,4 @@ public final class ResponseWrapper exten
         jClass.setNamespace(resNs);
         return jClass;
     }
-
 }

Modified: cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.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/Wrapper.java?rev=984487&r1=984486&r2=984487&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
Wed Aug 11 17:34:32 2010
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
@@ -28,6 +29,7 @@ import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.jws.WebParam;
 import javax.xml.namespace.QName;
 import javax.xml.ws.Holder;
 
@@ -111,7 +113,7 @@ public class Wrapper {
 
         if (StringUtils.isEmpty(c1.getName())) {
             c1.setName(c2.getName());
-        }
+        }       
         return c1;
     }
     
@@ -226,5 +228,14 @@ public class Wrapper {
         type = type.replace('$', '.');
         return type;
     }
+    
+    protected WebParam getWebParamAnnotation(final Annotation[] annotations) {
+        for (Annotation annotation : annotations) {
+            if (annotation instanceof WebParam) {
+                return (WebParam)annotation;
+            }
+        }
+        return null;
+    }
 
 }

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=984487&r1=984486&r2=984487&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
Wed Aug 11 17:34:32 2010
@@ -27,7 +27,6 @@ import org.apache.cxf.common.util.Compil
 import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolTestBase;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -80,6 +79,21 @@ public class JavaToWSTest extends ToolTe
         checkStdErr();
         assertTrue("Failed to generate WSDL file", wsdlFile.exists());
     }
+    
+    @Test
+    public void testCXF2934() throws Exception {
+        String[] args = new String[] {
+            "-wsdl", "-wrapperbean",
+            "-s", output.getPath(), 
+            "-o", output.getPath() + "/tmp.wsdl", 
+            "org.apache.cxf.tools.fortest.cxf2934.WebParamService"
+        };
+        JavaToWS.main(args);
+        File wrapper = outputFile("org/apache/cxf/tools/fortest/cxf2934/jaxws/HelloResponse.java");
+        String str = FileUtils.getStringFromFile(wrapper);
+        assertTrue("namespace value in annoataion @XmlElement is not correct"
+                   , str.indexOf("helloString/Name") > -1);
+    }
 
     private void checkStdErr() {
         String err = getStdErr();



Mime
View raw message