Description
The test wsdl below works with wsdl2java but throws NPE with wsdl2js.
wsdl2js - Apache CXF 2.2.6
WSDLToJS Error : java.lang.NullPointerException
org.apache.cxf.tools.common.ToolException: java.lang.NullPointerException
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:279)
at org.apache.cxf.tools.wsdlto.javascript.JavaScriptContainer.execute(JavaScriptContainer.java:151)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:67)
at org.apache.cxf.tools.wsdlto.javascript.WSDLToJavaScript.run(WSDLToJavaScript.java:60)
at org.apache.cxf.tools.wsdlto.javascript.WSDLToJavaScript.main(WSDLToJavaScript.java:97)
Caused by: java.lang.NullPointerException
at org.apache.ws.commons.schema.XmlSchemaCollection.getTypeByQName(XmlSchemaCollection.java:595)
at org.apache.cxf.common.xmlschema.SchemaCollection.getTypeByQName(SchemaCollection.java:130)
at org.apache.cxf.javascript.service.ServiceJavascriptBuilder.getElementsForParts(ServiceJavascriptBuilder.java:746)
at org.apache.cxf.javascript.service.ServiceJavascriptBuilder.createResponseDeserializer(ServiceJavascriptBuilder.java:522)
at org.apache.cxf.javascript.service.ServiceJavascriptBuilder.end(ServiceJavascriptBuilder.java:275)
at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:76)
at org.apache.cxf.tools.wsdlto.javascript.WSDLToJavaScriptProcessor.process(WSDLToJavaScriptProcessor.java:93)
at org.apache.cxf.tools.wsdlto.javascript.JavaScriptContainer.execute(JavaScriptContainer.java:144)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:271)
... 5 more
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsdLocal1="http://www.sun.com/xml/xyz"
targetNamespace="http://www.sun.com/abc/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.sun.com/abc/">
<types>
<xsd:schema
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xsdLocal1="http://www.sun.com/xml/xyz"
targetNamespace="http://www.sun.com/xml/xyz"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation>Test case wsdl</xsd:documentation>
</xsd:annotation>
<xsd:element
name="element1"
type="xsd:string">
</xsd:element>
</xsd:schema>
<xsd:schema
elementFormDefault="qualified"
attributeFormDefault="unqualified"
targetNamespace="http://www.sun.com/abc/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import
namespace="http://www.sun.com/xml/xyz">
</xsd:import>
<xsd:element name="Input">
<xsd:complexType>
<xsd:sequence>
<xsd:element
name="aaa"
minOccurs="0"
type="xsd:string">
</xsd:element>
<xsd:element
ref="xsdLocal1:element1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Output">
<xsd:complexType>
<xsd:sequence>
<xsd:element
ref="xsdLocal1:element1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="Input">
<part name="Input" element="tns:Input"></part>
</message>
<message name="Output">
<part name="Output" element="tns:Output"></part>
</message>
<portType name="Operation1WSPort">
<operation name="Operation1">
<input message="tns:Input"></input>
<output message="tns:Output"></output>
</operation>
</portType>
<binding
name="Operation1WSPort"
type="tns:Operation1WSPort">
<soap:binding
transport="http://schemas.xmlsoap.org/soap/http"
style="document">
</soap:binding>
<operation name="Operation1">
<soap:operation
soapAction="document/http://www.sun.com/abc/:Operation1">
</soap:operation>
<input><soap:body use="literal"></soap:body></input>
<output><soap:body use="literal"></soap:body></output>
</operation>
</binding>
<service name="Operation1WS">
<port binding="tns:Operation1WSPort" name="Operation1WSPort">
<soap:address
location="http://localhost:8080/test">
</soap:address>
</port>
</service>
</definitions>