Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-1867

NullPointerException generating WSDL with anonymous simple types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • nightly
    • None
    • codegen
    • None
    • Axis2 1.1.1-SNAPSHOT (nightly build), JDK 1.5.0_08 x64, Windows XP x64

    Description

      WSDL2Java is failing on a WSDL that has multiple anonymous simple types with a NullPointerException.

      This may be related to issue AXIS2-1780, however this WSDL was tried with the latest nightly build (built 2006-12-13).

      The following is output of the error with the nightly build. The same error occurs with Axis2 1.1.

      Using AXIS2_HOME: c:\java\axis2-1.1.1-SNAPSHOT
      Using JAVA_HOME: c:\java\jdk\jdk1.5.0_08-x64
      Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
      at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224)
      at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
      at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
      Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
      at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:52)
      at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:177)
      ... 2 more
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:49)
      ... 3 more
      Caused by: org.apache.axis2.schema.SchemaCompilationException: java.lang.NullPointerException
      at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:257)
      at org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java:72)
      ... 8 more
      Caused by: java.lang.NullPointerException
      at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:592)
      at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:489)
      at org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:1488)
      at org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:1450)
      at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:950)
      at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:909)
      at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:864)
      at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:527)
      at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:489)
      at org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:1488)
      at org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:1450)
      at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:950)
      at org.apache.axis2.schema.SchemaCompiler.processAnonymousComplexSchemaType(SchemaCompiler.java:883)
      at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:866)
      at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:527)
      at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:499)
      at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:336)
      at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:248)
      ... 9 more

      It seems that removing one of the anonymous simple types allows the code to be generated without error.

      The following WSDL was used (simplest form of original to reproduce bug):

      <?xml version="1.0"?>
      <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://my.service.namespace" targetNamespace="http://my.service.namespace" xmlns="http://schemas.xmlsoap.org/wsdl/">
      <types>
      <xsd:schema elementFormDefault="qualified" targetNamespace="http://my.service.namespace">
      <xsd:element name="goodMorning">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="goodMorningDto" type="ns:goodMorningRequestDto" minOccurs="1" maxOccurs="1" />
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      <xsd:element name="goodMorningResultDto">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="goodMorningResultDto" type="ns:goodMorningResultDtoType" minOccurs="1" maxOccurs="1" />
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      <xsd:complexType name="goodMorningRequestDto">
      <xsd:sequence>
      <xsd:element name="postcode" minOccurs="0" maxOccurs="1">
      <xsd:simpleType>
      <xsd:restriction base="xsd:string">
      <xsd:maxLength value="4"/>
      </xsd:restriction>
      </xsd:simpleType>
      </xsd:element>
      </xsd:sequence>
      </xsd:complexType>
      <xsd:complexType name="goodMorningResultDtoType">
      <xsd:sequence>
      <xsd:element name="status" minOccurs="0" maxOccurs="1">
      <xsd:simpleType>
      <xsd:restriction base="xsd:string">
      <xsd:maxLength value="1"/>
      </xsd:restriction>
      </xsd:simpleType>
      </xsd:element>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:schema>
      </types>

      <message name="goodMorningRequest">
      <part name="parameter" element="ns:goodMorning"/>
      </message>
      <message name="goodMorningResponse">
      <part name="parameter" element="ns:goodMorningResultDto"/>
      </message>

      <portType name="goodMorningPortType">
      <operation name="sayGoodMorning">
      <input message="ns:sayGoodMorningRequest"/>
      <output message="ns:sayGoodMorningResponse"/>
      </operation>
      </portType>
      <binding name="goodMorningSoapBinding" type="ns:goodMorningPortType">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
      <operation name="sayGoodMorning">
      <soap:operation soapAction="http://www.test.com/goodMorning" style="document" />
      <input>
      <soap:body use="literal"/>
      </input>
      <output>
      <soap:body use="literal"/>
      </output>
      </operation>
      </binding>
      <service name="goodMorning">
      <port name="goodMorningPort" binding="ns:goodMorningSoapBinding">
      <soap:address location="http://localhost:8080/test"/>
      </port>
      </service>
      </definitions>

      Attachments

        1. SchemaCompiler.java-patch.txt
          2 kB
          Amila Chinthaka Suriarachchi
        2. adb_codegen.patch
          1 kB
          Amila Chinthaka Suriarachchi

        Issue Links

          Activity

            People

              dims Davanum Srinivas
              prunge Peter Runge
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: