cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r984417 - in /cxf/trunk: 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/tools/wsdlto/jaxws...
Date Wed, 11 Aug 2010 14:12:50 GMT
Author: ema
Date: Wed Aug 11 14:12:50 2010
New Revision: 984417

URL: http://svn.apache.org/viewvc?rev=984417&view=rev
Log:
[CXF-2935]:Generate targetNamespace in @WebParam for the wrapped reference element

Added:
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2935/
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2935/webservice.wsdl
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    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/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=984417&r1=984416&r2=984417&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Wed Aug
11 14:12:50 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/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=984417&r1=984416&r2=984417&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
Wed Aug 11 14:12:50 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/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=984417&r1=984416&r2=984417&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
Wed Aug 11 14:12:50 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;
@@ -51,6 +52,19 @@ import org.junit.Test;
 
 
 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

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2935/webservice.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2935/webservice.wsdl?rev=984417&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2935/webservice.wsdl
(added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf2935/webservice.wsdl
Wed Aug 11 14:12:50 2010
@@ -0,0 +1,127 @@
+<?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="webParamWebServiceService"
+	targetNamespace="http://cxf.apache.org" xmlns:ns1="helloString/Name"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://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="helloString/Name"
+			xmlns:tns="http://cxf.apache.org" attributeFormDefault="unqualified"
+			elementFormDefault="unqualified" targetNamespace="http://cxf.apache.org">
+			<xs:import namespace="helloString/Name" />
+			<xs:element name="helloString" type="tns:helloString"/>
+			<xs:element name="helloStringResponse" type="tns:helloStringResponse"/>
+			<xs:complexType name="helloString">
+				<xs:sequence>
+					<xs:element minOccurs="0" ref="ns1:Name" />
+				</xs:sequence>
+			</xs:complexType>
+			<xs:complexType name="name">
+				<xs:sequence>
+					<xs:element minOccurs="0" name="firstName" type="xs:string" />
+					<xs:element minOccurs="0" name="lastName" type="xs:string" />
+				</xs:sequence>
+			</xs:complexType>
+			<xs:complexType name="helloStringResponse">
+				<xs:sequence>
+					<xs:element minOccurs="0" name="return" type="xs:string" />
+					<xs:element minOccurs="0" ref="ns1:Name" />
+					<xs:element minOccurs="0" name="Employee" type="tns:employee" />
+				</xs:sequence>
+			</xs:complexType>
+			<xs:complexType name="employee">
+				<xs:sequence>
+					<xs:element minOccurs="0" name="address" type="tns:address" />
+					<xs:element minOccurs="0" name="dept" type="tns:department" />
+					<xs:element minOccurs="0" name="name" type="tns:name" />
+					<xs:element minOccurs="0" name="salary" type="tns:salary" />
+					<xs:element minOccurs="0" name="title" type="xs:string" />
+					<xs:element name="type" type="xs:int" />
+				</xs:sequence>
+			</xs:complexType>
+			<xs:complexType name="address">
+				<xs:sequence>
+					<xs:element minOccurs="0" name="city" type="xs:string" />
+					<xs:element minOccurs="0" name="country" type="xs:string" />
+					<xs:element minOccurs="0" name="email" type="xs:string" />
+					<xs:element minOccurs="0" name="phone" type="xs:string" />
+					<xs:element minOccurs="0" name="state" type="xs:string" />
+					<xs:element minOccurs="0" name="street" type="xs:string" />
+					<xs:element minOccurs="0" name="zipcode" type="xs:string" />
+				</xs:sequence>
+			</xs:complexType>
+			<xs:complexType name="department">
+				<xs:sequence>
+					<xs:element minOccurs="0" name="location" type="xs:string" />
+					<xs:element minOccurs="0" name="name" type="xs:string" />
+				</xs:sequence>
+			</xs:complexType>
+			<xs:complexType name="salary">
+				<xs:sequence>
+					<xs:element name="bonusPercentage" type="xs:int" />
+					<xs:element minOccurs="0" name="currency" type="xs:string" />
+					<xs:element name="salary" type="xs:int" />
+				</xs:sequence>
+			</xs:complexType>
+		</xs:schema>
+		<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+			xmlns:ns1="http://cxf.apache.org" targetNamespace="helloString/Name"
+			version="1.0">
+			<xs:import namespace="http://cxf.apache.org" />
+			<xs:element name="Name" type="ns1:name" />
+		</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="webParamWebService">
+		<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="webParamWebServiceServiceSoapBinding"
+		type="tns:webParamWebService">
+		<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="webParamWebServiceService">
+		<wsdl:port name="webParamWebServicePort" binding="tns:webParamWebServiceServiceSoapBinding">
+			<soap:address location="http://localhost:9090/webParamWebServicePort" />
+		</wsdl:port>
+	</wsdl:service>
+</wsdl:definitions>



Mime
View raw message