cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r984490 - in /cxf/branches/2.2.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/ tools/wsdlto/test/src/test/java/org/apache/cxf/...
Date Wed, 11 Aug 2010 17:39:22 GMT
Author: dkulp
Date: Wed Aug 11 17:39:22 2010
New Revision: 984490

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

........
  r984417 | ema | 2010-08-11 10:12:50 -0400 (Wed, 11 Aug 2010) | 1 line
  
  [CXF-2935]:Generate targetNamespace in @WebParam for the wrapped reference element
........

Added:
    cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2935/
      - copied from r984417, cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2935/
    cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2935/webservice.wsdl
      - copied unchanged from r984417, cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2935/webservice.wsdl
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

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

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=984490&r1=984489&r2=984490&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
Wed Aug 11 17:39:22 2010
@@ -762,6 +762,7 @@ public class WSDLServiceBuilder {
                     mpi.setElementQName(el.getRefName());
                     mpi.setElement(true);
                     mpi.setXmlSchema(el);
+                    mpi.setProperty("isRefElement", true);
                     // element reference is not permitted for wrapper element
                     if (!allowRefs) {
                         ret = false;

Modified: cxf/branches/2.2.x-fixes/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/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?rev=984490&r1=984489&r2=984490&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
Wed Aug 11 17:39:22 2010
@@ -35,6 +35,7 @@ import org.apache.cxf.common.util.String
 import org.apache.cxf.jaxb.JAXBUtils;
 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.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
@@ -420,7 +421,8 @@ public class ParameterProcessor extends 
                     }
                     JavaParameter jp = getParameterFromQName(outputPart.getElementQName(),
outElement,
                                                              JavaType.Style.INOUT, outputPart);
-                    if (!qualified) {
+                    
+                    if (!qualified && !isRefElement(outputPart, outElement)) {
                         jp.setTargetNamespace("");
                     }
                     if (!jpIn.getClassName().equals(jp.getClassName())) {
@@ -471,7 +473,8 @@ public class ParameterProcessor extends 
                         }
                         JavaParameter jp = getParameterFromQName(outputPart.getElementQName(),
outElement,
                                                                  JavaType.Style.INOUT, outputPart);
-                        if (!qualified) {
+                        
+                        if (!qualified && !isRefElement(outputPart, outElement))
{
                             jp.setTargetNamespace("");
                         }
                         if (!jpIn.getClassName().equals(jp.getClassName())) {
@@ -486,7 +489,7 @@ public class ParameterProcessor extends 
             if (!sameWrapperChild) {
                 JavaParameter  jp = getParameterFromQName(outputPart.getElementQName(), outElement,
                                                           JavaType.Style.OUT, outputPart);
-                if (!qualified) {
+                if (!qualified && !isRefElement(outputPart, outElement)) {
                     jp.setTargetNamespace("");
                 }
                 
@@ -801,4 +804,13 @@ public class ParameterProcessor extends 
         }
         return true;
     }
+
+    private boolean isRefElement(MessagePartInfo outputPart, QName outElement) {
+        OperationInfo wrappedOp = outputPart.getMessageInfo().getOperation().getUnwrappedOperation();
+        MessagePartInfo mpart = wrappedOp.getOutput().getMessagePart(outElement);
+        if (mpart == null) {
+            return false;
+        }
+        return mpart.getProperty("isRefElement") != null;
+    }
 }

Modified: cxf/branches/2.2.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.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=984490&r1=984489&r2=984490&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Wed Aug 11 17:39:22 2010
@@ -27,6 +27,7 @@ import java.lang.reflect.Modifier;
 import java.util.Arrays;
 import java.util.List;
 
+import javax.jws.WebParam;
 import javax.jws.WebService;
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebFault;
@@ -50,6 +51,19 @@ import org.mortbay.jetty.handler.Resourc
 
 
 public class CodeGenBugTest extends AbstractCodeGenTest {
+ 
+    @Test
+    public void testCXF2935() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, 
+                getLocation("/wsdl2java_wsdl/cxf2935/webservice.wsdl"));
+        env.put(ToolConstants.CFG_ALLOW_ELEMENT_REFS, "true");
+        processor.setContext(env);
+        processor.execute();
+        Class<?> clz = classLoader.loadClass("org.apache.cxf.WebParamWebService");
+        WebParam webParam = AnnotationUtil.getWebParam(clz.getMethods()[0], "Name");    
  
+        assertEquals("helloString/Name", webParam.targetNamespace());
+          
+    }   
     
     
     @Test



Mime
View raw message