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 2007/03/19 08:16:51 UTC

svn commit: r519860 - in /incubator/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/

Author: ema
Date: Mon Mar 19 00:16:49 2007
New Revision: 519860

URL: http://svn.apache.org/viewvc?view=rev&rev=519860
Log:
[CXF-465]Fixed issue with error targetNamespace in WebResult annotation generated from a part which  element is a reference element

Modified:
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/locator.wsdl

Modified: incubator/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/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?view=diff&rev=519860&r1=519859&r2=519860
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java Mon Mar 19 00:16:49 2007
@@ -332,10 +332,12 @@
             simpleJavaName = fullJavaName.substring(index);    
         }
         
-        String targetNamespace = ProcessorUtil.resolvePartNamespace(part);
-        if (targetNamespace == null) {
-            targetNamespace = element.getNamespaceURI();
+        String targetNamespace = element.getNamespaceURI();
+         
+        if ("".equals(targetNamespace)) {
+            targetNamespace = ProcessorUtil.resolvePartNamespace(part);
         }
+        
         String jpname = ProcessorUtil.mangleNameToVariableName(simpleJavaName);
         JavaReturn returnType = new JavaReturn(jpname, fullJavaName , targetNamespace);
         returnType.setQName(element);

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?view=diff&rev=519860&r1=519859&r2=519860
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java Mon Mar 19 00:16:49 2007
@@ -56,8 +56,8 @@
         classLoader = AnnotationUtil.getClassLoader(Thread.currentThread().getContextClassLoader());
         env.put(ToolConstants.CFG_COMPILE, ToolConstants.CFG_COMPILE);
         env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
-        
-        processor = new JAXWSContainer(null); 
+
+        processor = new JAXWSContainer(null);
 
 
     }
@@ -67,7 +67,7 @@
         processor = null;
         env = null;
     }
-    
+
 
     public void testRPCLit() throws Exception {
 
@@ -704,7 +704,7 @@
         Class clz = classLoader.loadClass("org.apache.hello_world_soap_http.types.ActionType");
         assertNotNull("Enum class could not be found", clz);
     }
-    
+
     public void testSWAMime() throws Exception {
 
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/swa-mime.wsdl"));
@@ -774,27 +774,30 @@
         assertTrue(locator.exists());
         File locatorService = new File(locator, "LocatorService.java");
         assertTrue(locatorService.exists());
-        
+
 
         Class<?> clz = classLoader.loadClass("org.apache.locator.LocatorService");
 
         javax.jws.WebService ws = AnnotationUtil.getPrivClassAnnotation(clz, javax.jws.WebService.class);
         assertTrue("Webservice annotation wsdlLocation should begin with file", ws.wsdlLocation()
                    .startsWith("file"));
-        
+
         Class<?> paraClass = classLoader.loadClass("org.apache.locator.query.QuerySelectType");
         Method method = clz.getMethod("queryEndpoints", new Class[] {paraClass});
+        WebResult webRes = AnnotationUtil.getPrivMethodAnnotation(method, WebResult.class);
+        assertEquals("http://www.w3.org/2005/08/addressing", webRes.targetNamespace());
+        assertEquals("EndpointReference", webRes.name());
         WebParam webParamAnn = AnnotationUtil.getWebParam(method, "select");
         assertEquals("http://apache.org/locator/query", webParamAnn.targetNamespace());
-        
+
         method = clz.getMethod("deregisterPeerManager", new Class[] {String.class});
         webParamAnn = AnnotationUtil.getWebParam(method, "node_id");
         assertEquals("http://apache.org/locator/types", webParamAnn.targetNamespace());
-        
-        
-        
+
+
+
     }
-    
+
     public void testWebFaultAnnotaion() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/jms_test_rpc_fault.wsdl"));
         env.put(ToolConstants.CFG_SERVICENAME, "HelloWorldService");
@@ -803,9 +806,9 @@
         Class cls = classLoader.loadClass("org.apache.cxf.hello_world_jms.BadRecordLitFault");
         WebFault webFault = AnnotationUtil.getPrivClassAnnotation(cls, WebFault.class);
         assertEquals("http://www.w3.org/2001/XMLSchema", webFault.targetNamespace());
-        
+
     }
-    
+
 
     private String getLocation(String wsdlFile) throws URISyntaxException {
         return this.getClass().getResource(wsdlFile).toURI().getPath();

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/locator.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/locator.wsdl?view=diff&rev=519860&r1=519859&r2=519860
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/locator.wsdl (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/locator.wsdl Mon Mar 19 00:16:49 2007
@@ -312,22 +312,10 @@
                 </xs:complexType>
             </xs:element>
             <xs:element name="queryEndpointsResponse">
-                <xs:annotation>
-                    <xs:documentation>Output message element for &quot;queryEndpoints&quot; operation.</xs:documentation>
-                </xs:annotation>
-                <xs:complexType>
-                    <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="endpoint">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="endpoint_id" 
-                                        type="tns:EndpointIdentity"/>
-                                    <xs:element name="endpoint_reference" 
-                                        type="wsa:EndpointReferenceType"/>
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
+               <xs:complexType>
+	                           <xs:sequence>
+	                               <xs:element ref="wsa:EndpointReference"/>
+	                           </xs:sequence>
                 </xs:complexType>
             </xs:element>
             <xs:complexType name="EndpointNotExistFaultException">