cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1210614 - in /cxf/trunk: rt/javascript/src/main/java/org/apache/cxf/javascript/service/ tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/ tools/wsdlto/frontend/javascript/src/test/resources/org/apache/c...
Date Mon, 05 Dec 2011 20:44:31 GMT
Author: dkulp
Date: Mon Dec  5 20:44:31 2011
New Revision: 1210614

URL: http://svn.apache.org/viewvc?rev=1210614&view=rev
Log:
[CXF-3891] wsdl2js NPE's with element references to an element with an
anonymous type

Added:
    cxf/trunk/tools/wsdlto/frontend/javascript/src/test/resources/org/apache/cxf/tools/wsdlto/javascript/hello_world_ref.wsdl
  (with props)
Modified:
    cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
    cxf/trunk/tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptTest.java

Modified: cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=1210614&r1=1210613&r2=1210614&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
(original)
+++ cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
Mon Dec  5 20:44:31 2011
@@ -740,7 +740,8 @@ public class ServiceJavascriptBuilder ex
                         if (element.getSchemaTypeName() != null) {
                             element.setSchemaType(xmlSchemaCollection
                                                   .getTypeByQName(element.getSchemaTypeName()));
-                        } else if (element.getRef().getTargetQName() != null) {
+                        } else if (element.getRef().getTargetQName() != null
+                            && element.getRef().getTarget().getSchemaTypeName() !=
null) {
                             element = element.getRef().getTarget();
                             element.setSchemaType(xmlSchemaCollection
                                                   .getTypeByQName(element.getSchemaTypeName()));

Modified: cxf/trunk/tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptTest.java?rev=1210614&r1=1210613&r2=1210614&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptTest.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptTest.java
Mon Dec  5 20:44:31 2011
@@ -53,6 +53,25 @@ public class WSDLToJavaScriptTest extend
         String javascript = IOUtils.readStringFromStream(fis);
         assertTrue(javascript.contains("xmlns:murble='http://apache.org/hello_world_soap_http'"));
     }
-    
+   
+    @Test
+    public void testCXF3891() throws Exception {
+        JavaScriptContainer container = new JavaScriptContainer(null);
+
+        ToolContext context = new ToolContext();
+        context.put(ToolConstants.CFG_WSDLURL, getLocation("hello_world_ref.wsdl"));
+        context.put(ToolConstants.CFG_OUTPUTDIR, output.toString()); 
+        String[] prefixes = new String[1];
+        prefixes[0] = "http://apache.org/hello_world_soap_http=murble";
+        context.put(ToolConstants.CFG_JSPACKAGEPREFIX, prefixes);
+        container.setContext(context); 
+        container.execute();
+        // now we really want to check some results.
+        File resultFile = new File(output, "SOAPService.js");
+        assertTrue(resultFile.canRead());
+        FileInputStream fis = new FileInputStream(resultFile);
+        String javascript = IOUtils.readStringFromStream(fis);
+        assertTrue(javascript.contains("xmlns:murble='http://apache.org/hello_world_soap_http'"));
+    }
    
 }

Added: cxf/trunk/tools/wsdlto/frontend/javascript/src/test/resources/org/apache/cxf/tools/wsdlto/javascript/hello_world_ref.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/javascript/src/test/resources/org/apache/cxf/tools/wsdlto/javascript/hello_world_ref.wsdl?rev=1210614&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/javascript/src/test/resources/org/apache/cxf/tools/wsdlto/javascript/hello_world_ref.wsdl
(added)
+++ cxf/trunk/tools/wsdlto/frontend/javascript/src/test/resources/org/apache/cxf/tools/wsdlto/javascript/hello_world_ref.wsdl
Mon Dec  5 20:44:31 2011
@@ -0,0 +1,80 @@
+<?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 xmlns="http://schemas.xmlsoap.org/wsdl/"
+      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+      xmlns:tns="http://apache.org/hello_world_soap_http"
+      xmlns:x1="http://apache.org/hello_world_soap_http/types"
+      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+      targetNamespace="http://apache.org/hello_world_soap_http" name="HelloWorld">
+    <wsdl:types>
+        <schema targetNamespace="http://apache.org/hello_world_soap_http/types" xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:x1="http://apache.org/hello_world_soap_http/types" elementFormDefault="qualified">
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element ref="x1:responseType"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="responseType">
+                <complexType>
+                    <sequence>
+                        <element name="message" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part name="in" element="x1:sayHi"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part name="out" element="x1:sayHiResponse"/>
+    </wsdl:message>
+    <wsdl:portType name="Greeter">
+        <wsdl:operation name="sayHi">
+            <wsdl:input name="sayHiRequest" message="tns:sayHiRequest"/>
+            <wsdl:output name="sayHiResponse" message="tns:sayHiResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="sayHi">
+            <soap:operation style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:service name="SOAPService">
+        <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Propchange: cxf/trunk/tools/wsdlto/frontend/javascript/src/test/resources/org/apache/cxf/tools/wsdlto/javascript/hello_world_ref.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/wsdlto/frontend/javascript/src/test/resources/org/apache/cxf/tools/wsdlto/javascript/hello_world_ref.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/tools/wsdlto/frontend/javascript/src/test/resources/org/apache/cxf/tools/wsdlto/javascript/hello_world_ref.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message