cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r523177 - in /incubator/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/generators/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/...
Date Wed, 28 Mar 2007 05:13:16 GMT
Author: ema
Date: Tue Mar 27 22:13:15 2007
New Revision: 523177

URL: http://svn.apache.org/viewvc?view=rev&rev=523177
Log:
[CXF-495]Enable tools to generate code for wsdl which has no service or portType element

Added:
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/no_port_or_service.wsdl
  (with props)
Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AbstractJAXWSGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AntGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ClientGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/Messages.properties
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessor.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
Tue Mar 27 22:13:15 2007
@@ -166,12 +166,32 @@
         defList.add(d);
         parseImports(d, defList);        
         for (Definition def : defList) {
+             
             for (Iterator ite = def.getPortTypes().entrySet().iterator(); ite.hasNext();)
{
                 Entry entry = (Entry)ite.next();
                 PortType portType = def.getPortType((QName)entry.getKey());
                 ServiceInfo serviceInfo = this.buildMockService(def, portType);
                 serviceList.add(serviceInfo);
-            }     
+            }
+            
+            if (def.getPortTypes().size() == 0) {
+               
+                DescriptionInfo description = new DescriptionInfo();
+                description.setProperty(WSDL_DEFINITION, def);
+                description.setName(def.getQName());
+                description.setBaseURI(def.getDocumentBaseURI());
+                copyExtensors(description, def.getExtensibilityElements());
+                copyExtensionAttributes(description, def);
+                
+                ServiceInfo service = new ServiceInfo();
+                service.setDescription(description);
+                service.setProperty(WSDL_DEFINITION, def);
+                XmlSchemaCollection schemas = getSchemas(def, service);
+                        
+                service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);       
+                service.setProperty(WSDL_SCHEMA_LIST, schemas);
+                serviceList.add(service);
+            }            
         }
         return serviceList;
     }

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AbstractJAXWSGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AbstractJAXWSGenerator.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AbstractJAXWSGenerator.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AbstractJAXWSGenerator.java
Tue Mar 27 22:13:15 2007
@@ -19,11 +19,15 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.generators;
 
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.wsdlto.core.AbstractGenerator;
 
 public abstract class AbstractJAXWSGenerator extends AbstractGenerator {
+    protected static final Logger LOG = LogUtils.getL7dLogger(AbstractJAXWSGenerator.class);
     protected static final String TEMPLATE_BASE = "org/apache/cxf/tools/wsdlto/frontend/jaxws/template";
 
     public abstract boolean passthrough();

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AntGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AntGenerator.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AntGenerator.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AntGenerator.java
Tue Mar 27 22:13:15 2007
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.generators;
 
+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;
@@ -46,6 +48,16 @@
         JavaModel javaModel = env.get(JavaModel.class);
         
         if (passthrough()) {
+            return;
+        }
+        
+        if (javaModel.getServiceClasses().size() == 0) {
+            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+            String wsdl = serviceInfo.getDescription().getBaseURI();
+            Message msg = new Message("CAN_NOT_GEN_ANT", LOG, wsdl);
+            if (penv.isVerbose()) {
+                System.out.println(msg.toString());
+            }
             return;
         }
 

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ClientGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ClientGenerator.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ClientGenerator.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ClientGenerator.java
Tue Mar 27 22:13:15 2007
@@ -22,6 +22,8 @@
 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;
@@ -64,8 +66,12 @@
             return;
         }
         if (javaModel.getServiceClasses().size() == 0) {
-            System.out.println("WSDL2Java Warning : can not generate " 
-                               + "client for an WSDL has no service");
+            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+            String wsdl = serviceInfo.getDescription().getBaseURI();
+            Message msg = new Message("CAN_NOT_GEN_CLIENT", LOG, wsdl);
+            if (penv.isVerbose()) {
+                System.out.println(msg.toString());
+            }
             return;
         }
 

Modified: incubator/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/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
Tue Mar 27 22:13:15 2007
@@ -22,6 +22,8 @@
 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;
@@ -68,7 +70,19 @@
         }
 
         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: incubator/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/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/Messages.properties?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/Messages.properties
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/Messages.properties
Tue Mar 27 22:13:15 2007
@@ -22,3 +22,9 @@
 VELOCITY_ENGINE_WRITE_ERRORS = velocity engin write errors
 FAIL_TO_WRITE_FILE = Failed to write file : {0}
 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: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java
Tue Mar 27 22:13:15 2007
@@ -22,6 +22,8 @@
 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;
@@ -36,28 +38,24 @@
         this.name = ToolConstants.SEI_GENERATOR;
     }
 
-    public boolean passthrough() {      
-        if (env.optionSet(ToolConstants.CFG_GEN_SEI)
-            || env.optionSet(ToolConstants.CFG_ALL)) {
+    public boolean passthrough() {
+        if (env.optionSet(ToolConstants.CFG_GEN_SEI) || env.optionSet(ToolConstants.CFG_ALL))
{
             return false;
-        } 
-        if (env.optionSet(ToolConstants.CFG_GEN_ANT)
-            || env.optionSet(ToolConstants.CFG_GEN_TYPES)
-            || env.optionSet(ToolConstants.CFG_GEN_CLIENT)
-            || env.optionSet(ToolConstants.CFG_GEN_IMPL)
-            || env.optionSet(ToolConstants.CFG_GEN_SERVER)
-            || env.optionSet(ToolConstants.CFG_GEN_SERVICE)) {
+        }
+        if (env.optionSet(ToolConstants.CFG_GEN_ANT) || env.optionSet(ToolConstants.CFG_GEN_TYPES)
+            || env.optionSet(ToolConstants.CFG_GEN_CLIENT) || env.optionSet(ToolConstants.CFG_GEN_IMPL)
+            || env.optionSet(ToolConstants.CFG_GEN_SERVER) || env.optionSet(ToolConstants.CFG_GEN_SERVICE))
{
             return true;
         }
-        
+
         return false;
-        
+
     }
 
     private boolean hasHandlerConfig(JavaInterface intf) {
-        //TODO : enbale handler chain
+        // TODO : enbale handler chain
         return intf.getHandlerChains() != null;
-        
+
     }
 
     public void generate(ToolContext penv) throws ToolException {
@@ -69,13 +67,24 @@
         }
 
         Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
+
+        if (interfaces.size() == 0) {
+            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+            String wsdl = serviceInfo.getDescription().getBaseURI();
+            Message msg = new Message("CAN_NOT_GEN_SEI", LOG, wsdl);
+            if (penv.isVerbose()) {
+                System.out.println(msg.toString());
+            }
+            return;
+        }
         for (Iterator iter = interfaces.keySet().iterator(); iter.hasNext();) {
             String interfaceName = (String)iter.next();
             JavaInterface intf = interfaces.get(interfaceName);
 
             if (hasHandlerConfig(intf)) {
                 HandlerConfigGenerator handlerGen = new HandlerConfigGenerator();
-                //REVISIT: find a better way to handle Handler gen, should not pass JavaInterface
around.
+                // REVISIT: find a better way to handle Handler gen, should not
+                // pass JavaInterface around.
                 handlerGen.setJavaInterface(intf);
                 handlerGen.generate(getEnvironment());
 

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
Tue Mar 27 22:13:15 2007
@@ -22,6 +22,8 @@
 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;
@@ -64,6 +66,17 @@
         }
         String address = "";
         Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
+        
+        if (javaModel.getServiceClasses().size() == 0) {
+            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+            String wsdl = serviceInfo.getDescription().getBaseURI();
+            Message msg = new Message("CAN_NOT_GEN_SRV", LOG, wsdl);
+            if (penv.isVerbose()) {
+                System.out.println(msg.toString());
+            }
+            return;
+        }
+        
         for (Iterator iter = interfaces.keySet().iterator(); iter.hasNext();) {
             String interfaceName = (String)iter.next();
             JavaInterface intf = interfaces.get(interfaceName);

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
Tue Mar 27 22:13:15 2007
@@ -22,6 +22,8 @@
 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;
@@ -62,6 +64,16 @@
 
         Map<String, JavaServiceClass> serviceClasses = javaModel.getServiceClasses();
 
+        if (serviceClasses.size() == 0) {
+            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+            String wsdl = serviceInfo.getDescription().getBaseURI();
+            Message msg = new Message("CAN_NOT_GEN_SERVICE", LOG, wsdl);
+            if (penv.isVerbose()) {
+                System.out.println(msg.toString());
+            }
+            return;
+        }
+        
         Iterator ite = serviceClasses.values().iterator();
 
         while (ite.hasNext()) {

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.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/WSDLToJavaProcessor.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
Tue Mar 27 22:13:15 2007
@@ -54,14 +54,13 @@
 
         ServiceProcessor serviceProcessor = new ServiceProcessor(context);
         serviceProcessor.process(serviceInfo);
-
-        JavaInterface intf = javaModel.getInterfaces().values().iterator().next();
-        intf.annotate(new WebServiceAnnotator());
-        if (serviceInfo.getBindings().size() > 0) {
-            intf.annotate(new BindingAnnotator());
+        if (javaModel.getInterfaces().values().iterator().hasNext()) {
+            JavaInterface intf = javaModel.getInterfaces().values().iterator().next();
+            intf.annotate(new WebServiceAnnotator());
+            if (serviceInfo.getBindings().size() > 0) {
+                intf.annotate(new BindingAnnotator());
+            }
         }
-
-
         return javaModel;
     }
 }

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessor.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/PortTypeProcessor.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessor.java
Tue Mar 27 22:13:15 2007
@@ -53,7 +53,10 @@
 
         InterfaceInfo interfaceInfo = serviceInfo.getInterface();
         
-
+        if (interfaceInfo == null) {
+            return;
+        }
+ 
         JavaInterface intf = new InterfaceMapper(context).map(interfaceInfo);
         intf.setJavaModel(jmodel);
 

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?view=diff&rev=523177&r1=523176&r2=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Tue Mar 27 22:13:15 2007
@@ -333,6 +333,7 @@
         assertNotNull(cls);
         cls = classLoader.loadClass("org.apache.hello_world2.Greeter2");
     }
+    
     public void testServiceNS() throws Exception {
         env.put(ToolConstants.CFG_ALL, ToolConstants.CFG_ALL);
         env.put(ToolConstants.CFG_WSDLURL, 
@@ -347,5 +348,13 @@
       
     }
     
+    public void testNoServiceNOPortType() throws Exception {
+        env.put(ToolConstants.CFG_ALL, ToolConstants.CFG_ALL);
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/no_port_or_service.wsdl"));
+        processor.setContext(env);
+        processor.execute();
+        Class clz = classLoader.loadClass("org.apache.cxf.no_port_or_service.types.TheComplexType");
+        assertNotNull(clz);
+    }
     
 }

Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/no_port_or_service.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/no_port_or_service.wsdl?view=auto&rev=523177
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/no_port_or_service.wsdl
(added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/no_port_or_service.wsdl
Tue Mar 27 22:13:15 2007
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name="no_port_or_service" 
+    targetNamespace="http://cxf.apache.org/no_port_or_service" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:tns="http://cxf.apache.org/no_port_or_service" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    xmlns:xsd1="http://cxf.apache.org/no_port_or_service/types">
+    <types>
+        <schema targetNamespace="http://cxf.apache.org/no_port_or_service/types"
+            xmlns="http://www.w3.org/2001/XMLSchema" 
+            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+            <complexType name="theComplexType">
+                <sequence>
+                    <element name="element_one" type="string"/>
+                    <element name="element_two" type="string"/>
+                </sequence>
+            </complexType>
+        </schema>
+    </types>
+</definitions>

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

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

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



Mime
View raw message