cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r736352 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/wsdl11/ tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/ tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1969/
Date Wed, 21 Jan 2009 17:52:13 GMT
Author: seanoc
Date: Wed Jan 21 09:52:13 2009
New Revision: 736352

URL: http://svn.apache.org/viewvc?rev=736352&view=rev
Log:
CXF-1969 wsdl2java - NPE when wsdl has a missing attribute

Added:
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1969/
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1969/report_incident.wsdl
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.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=736352&r1=736351&r2=736352&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 Jan
21 09:52:13 2009
@@ -265,6 +265,14 @@
         for (Port port : cast(serv.getPorts().values(), Port.class)) {
             Binding binding = port.getBinding();
             PortType bindingPt = binding.getPortType();
+            if (bindingPt == null) {
+                org.apache.cxf.common.i18n.Message msg = new 
+                org.apache.cxf.common.i18n.Message("BINDING_MISSING_TYPE",
+                                                   LOG,
+                                                   binding.getQName());
+                throw new WSDLRuntimeException(msg);
+            }
+
             //TODO: wsdl4j's bug. if there is recursive import,
             //wsdl4j can not get operation input message
             PortType pt = def.getPortType(bindingPt.getQName());

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=736352&r1=736351&r2=736352&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 Jan 21 09:52:13 2009
@@ -40,11 +40,27 @@
 import org.apache.cxf.tools.wsdlto.AbstractCodeGenTest;
 import org.apache.cxf.tools.wsdlto.WSDLToJava;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.validator.UniqueBodyValidator;
+import org.apache.cxf.wsdl11.WSDLRuntimeException;
+
 import org.junit.Test;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.handler.ResourceHandler;
 
 public class CodeGenBugTest extends AbstractCodeGenTest {
+    
+    
+    @Test
+    public void testCXF1969() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, 
+                getLocation("/wsdl2java_wsdl/cxf1969/report_incident.wsdl"));
+        processor.setContext(env);
+        
+        try {
+            processor.execute();
+        } catch (WSDLRuntimeException wrex) {
+            assertEquals("BINDING_MISSING_TYPE", wrex.getMessage());
+        }  
+    }
 
     @Test
     // Test for CXF-1678

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1969/report_incident.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1969/report_incident.wsdl?rev=736352&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1969/report_incident.wsdl
(added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1969/report_incident.wsdl
Wed Jan 21 09:52:13 2009
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+	xmlns:tns="http://reportincident.example.camel.apache.org"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+	targetNamespace="http://reportincident.example.camel.apache.org">
+
+    <!-- Type definitions for input- and output parameters for webservice -->
+    <wsdl:types>
+        <xs:schema targetNamespace="http://reportincident.example.camel.apache.org">
+            <xs:element name="inputReportIncident">
+                <xs:complexType name="inputReportIncident">
+                    <xs:sequence>
+                        <xs:element type="xs:string" name="incidentId"/>
+                        <xs:element type="xs:string" name="incidentDate"/>
+                        <xs:element type="xs:string" name="givenName"/>
+                        <xs:element type="xs:string" name="familyName"/>
+                        <xs:element type="xs:string" name="summary"/>
+                        <xs:element type="xs:string" name="details"/>
+                        <xs:element type="xs:string" name="email"/>
+                        <xs:element type="xs:string" name="phone"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="outputReportIncident">
+                <xs:complexType name="outputReportIncident">
+                    <xs:sequence>
+                        <xs:element type="xs:string" name="code"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+        </xs:schema>
+    </wsdl:types>
+
+    <!-- Message definitions for input and output -->
+    <wsdl:message name="inputReportIncident">
+        <wsdl:part name="in" element="tns:inputReportIncident"/>
+    </wsdl:message>
+    <wsdl:message name="outputReportIncident">
+        <wsdl:part name="out" element="tns:outputReportIncident"/>
+    </wsdl:message>
+
+    <!-- Port (interface) definitions -->
+    <wsdl:portType name="ReportIncidentEndpoint">
+        <wsdl:operation name="ReportIncident">
+            <wsdl:input message="tns:inputReportIncident"/>
+            <wsdl:output message="tns:outputReportIncident"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <!-- Port bindings to transports and encoding - HTTP, document literal encoding is
used -->
+    <wsdl:binding name="ReportIncidentBinding">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="ReportIncident">
+            <soap:operation
+                    soapAction="http://reportincident.example.camel.apache.org/ReportIncident"
+                    style="document"/>
+            <wsdl:input>
+                <soap:body parts="in" use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body parts="out" use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <!-- Service definition -->
+    <wsdl:service name="ReportIncidentEndpointService">
+        <wsdl:port name="ReportIncidentService" binding="tns:ReportIncidentBinding">
+            <soap:address location="http://localhost:8080/part-five/webservices/incident"/>
+        </wsdl:port>
+    </wsdl:service>
+
+</wsdl:definitions>



Mime
View raw message