Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
Current cvs tree (4262004) on Win XP
Description
If xsd:schema element is removed from the WSDL, the WSDL2Java is throwing an NPE in the beta-1 src tree.
For example, consider the following WSDL snippet..
<types>
<!-xsd:schema targetNamespace="http://MyService"->
<xsd:element name="MyString" type="xsd:string"/>
<!-/xsd:schema->
</types>
Running this WSDL (attached) produces no errors in Axis 1.1, but throws the following NPE on 1.2
java.lang.NullPointerException
at org.apache.axis.wsdl.symbolTable.Utils.getNodeNameQName(Utils.java:26
7)
at org.apache.axis.wsdl.symbolTable.SymbolTable.createTypeFromDef(Symbol
Table.java:1095)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.jav
a:971)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.jav
a:1077)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.jav
a:1077)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.jav
a:1077)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populateTypes(SymbolTabl
e.java:894)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:692)
at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:531
)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:506)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:483)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:356)
at java.lang.Thread.run(Thread.java:536)
On further investigation it seems that the cause is a change in the class org.apache.axis.wsdl.symbolTable.Utils.java between the 1.30.2.1 and the 1.30 versions:
Note that in the current version the code section under the following comment has changed....
// This routine may be called for complexType elements. In some cases
// the complexType may be anonymous, which is why the
// getScopedAttribute method is used.
The code section is no longer inside the if (localName == null) code block.
As a result if the xsd:schema element is removed from the WSDL, the search goes on till it hits the XML declaration for which the kind variable (line 265) returns null. This results in the NPE.
Omitting the xsd:schema may result in an incorrect WSDL, but an NPE should not be thrown. If the xsd:schema is not found, a proper error message should be generate.