You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/07/18 21:36:18 UTC

svn commit: r678009 - in /cxf/trunk/tools/wsdlto: frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/ test/src/test/java/org/apache/cxf/to...

Author: dkulp
Date: Fri Jul 18 12:36:17 2008
New Revision: 678009

URL: http://svn.apache.org/viewvc?rev=678009&view=rev
Log:
[CXF-1678] Patch from Mike Ramnarine applied

Added:
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1678/
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1678/hello_world_logical_only.wsdl   (with props)
Modified:
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/Messages.properties
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java?rev=678009&r1=678008&r2=678009&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java (original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java Fri Jul 18 12:36:17 2008
@@ -22,8 +22,6 @@
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
@@ -73,17 +71,7 @@
         Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
             
         Map<String, JavaServiceClass> services = javaModel.getServiceClasses();
-        
-        if (services.size() == 0) {
-            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
-            String wsdl = serviceInfo.getDescription().getBaseURI();
-            Message msg = new Message("CAN_NOT_GEN_IMPL", LOG, wsdl);
-            if (penv.isVerbose()) {
-                System.out.println(msg.toString());
-            }
-            return;
-        }
-        
+
         JavaServiceClass service = null;
         String port = "";
         if (!services.values().isEmpty()) {

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/Messages.properties?rev=678009&r1=678008&r2=678009&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/Messages.properties (original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/Messages.properties Fri Jul 18 12:36:17 2008
@@ -24,7 +24,6 @@
 FAIL_TO_GET_WSDL = Fail to get wsdl url from : {0}
 CAN_NOT_GEN_ANT = WSDL2Java Warning : can not generate ant build.xml for the WSDL has no service : {0}
 CAN_NOT_GEN_SEI = WSDL2Java Warning : can not generate interface class for an WSDL has no PortType : {0}
-CAN_NOT_GEN_IMPL= WSDL2Java Warning : can not generate impl class for an WSDL has no service : {0}
 CAN_NOT_GEN_SRV = WSDL2Java Warning : can not generate server class for an WSDL has no PortType : {0} 
 CAN_NOT_GEN_SERVICE = WSDL2Java Warning : can not generate service class for an WSDL has no service : {0}
 CAN_NOT_GEN_CLIENT = WSDL2Java Warning : can not generate client for an WSDL has no service : {0}
\ No newline at end of file

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm?rev=678009&r1=678008&r2=678009&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm (original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm Fri Jul 18 12:36:17 2008
@@ -35,9 +35,15 @@
  */
 
 @javax.jws.WebService(name = "$intf.Name",
+#if ($service.ServiceName != "") 
                       serviceName = "$service.ServiceName",
+#end
+#if ($port != "") 
                       portName = "$port",
+#end
+#if ($service.Namespace != "") 
                       targetNamespace = "$service.Namespace",
+#end
 #if ($intf.Location != "") 
                       wsdlLocation = "$intf.Location",
 #end

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=678009&r1=678008&r2=678009&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 Fri Jul 18 12:36:17 2008
@@ -83,6 +83,21 @@
     }
     
     @Test
+    // Test for CXF-1678
+    public void testLogicalOnlyWSDL() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, 
+                getLocation("/wsdl2java_wsdl/cxf-1678/hello_world_logical_only.wsdl"));
+        processor.setContext(env);
+        processor.execute();
+
+        assertNotNull("Trouble processing logical only wsdl", output);
+
+        Class clz = classLoader.loadClass("org.apache.cxf.cxf1678.hello_world_soap_http.GreeterImpl");
+        WebService webServiceAnn = AnnotationUtil.getPrivClassAnnotation(clz, WebService.class);
+        assertEquals("Greeter", webServiceAnn.name());
+    }
+
+    @Test
     public void testBug305729() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/bug305729/hello_world.wsdl"));
         processor.setContext(env);

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1678/hello_world_logical_only.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1678/hello_world_logical_only.wsdl?rev=678009&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1678/hello_world_logical_only.wsdl (added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1678/hello_world_logical_only.wsdl Fri Jul 18 12:36:17 2008
@@ -0,0 +1,136 @@
+<?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="HelloWorld" targetNamespace="http://cxf.apache.org/cxf1678/hello_world_soap_http"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:jms="http://cxf.apache.org/transports/jms"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+    xmlns:tns="http://cxf.apache.org/cxf1678/hello_world_soap_http"
+    xmlns:x1="http://cxf.apache.org/cxf1678/hello_world_soap_http/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <wsdl:types>
+        <schema targetNamespace="http://cxf.apache.org/cxf1678/hello_world_soap_http/types"
+            xmlns="http://www.w3.org/2001/XMLSchema"
+        xmlns:tns="http://cxf.apache.org/cxf1678/hello_world_soap_http/types"
+            elementFormDefault="qualified">
+
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeOneWay">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="pingMe">
+                <complexType>
+                    <sequence>
+                        <element name="faultType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="pingMeResponse">
+                <complexType/>
+            </element>
+            <element name="faultDetail">
+                <complexType>
+                    <sequence>
+                        <element name="minor" type="short"/>
+                        <element name="major" type="short"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part element="x1:sayHi" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part element="x1:sayHiResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMeResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeOneWayRequest">
+        <wsdl:part element="x1:greetMeOneWay" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="pingMeRequest">
+        <wsdl:part name="in" element="x1:pingMe"/>
+    </wsdl:message>
+    <wsdl:message name="pingMeResponse">
+        <wsdl:part name="out" element="x1:pingMeResponse"/>
+    </wsdl:message>
+    <wsdl:message name="pingMeFault">
+        <wsdl:part name="faultDetail" element="x1:faultDetail"/>
+    </wsdl:message>
+
+    <wsdl:portType name="Greeter">
+        <wsdl:operation name="sayHi">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+            <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+        </wsdl:operation>
+
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+
+        <wsdl:operation name="greetMeOneWay">
+            <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+        </wsdl:operation>
+
+        <wsdl:operation name="pingMe">
+            <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/>
+            <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/>
+            <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/>
+        </wsdl:operation>
+
+    </wsdl:portType>
+
+     <!-- No physical parts, to test CXF-1678 -->
+
+</wsdl:definitions>

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1678/hello_world_logical_only.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1678/hello_world_logical_only.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1678/hello_world_logical_only.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml