Null pointer exception in WSDL2C compiling schema when generating ADB
---------------------------------------------------------------------

                 Key: AXIS2C-768
                 URL: https://issues.apache.org/jira/browse/AXIS2C-768
             Project: Axis2-C
          Issue Type: Bug
          Components: wsdl2c tool
    Affects Versions: Current (Nightly)
         Environment: Windows XP
            Reporter: Bill Mitchell


When I attempt to generate C bindings for the WSDL file below, the WSDL2C 
utility fails with a null pointer exception without generating any stub code 
whatsoever.  

The exception trace is:
>java org.apache.axis2.wsdl.WSDL2C -or -d adb -wv 1.1 -u -uri service.wsdl
Retrieving document at 'service.wsdl'.
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:278)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
        at org.apache.axis2.wsdl.WSDL2C.main(WSDL2C.java:31)
Caused by: java.lang.RuntimeException: 
java.lang.reflect.InvocationTargetException
        at 
org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:53)
        at 
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:231)
        ... 2 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at 
org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:50)
        ... 3 more
Caused by: org.apache.axis2.schema.SchemaCompilationException: 
java.lang.NullPointerException
        at 
org.apache.axis2.schema.writer.CStructWriter.write(CStructWriter.java:197)
        at 
org.apache.axis2.schema.SchemaCompiler.writeComplexType(SchemaCompiler.java:939)
        at 
org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:925)
        at 
org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1087)
        at 
org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1054)
        at 
org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:998)
        at 
org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:919)
        at 
org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:833)
        at 
org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:531)
        at 
org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:491)
        at 
org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:1904)
        at 
org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:1791)
        at 
org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1170)
        at 
org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1054)
        at 
org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:998)
        at 
org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:919)
        at 
org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:833)
        at 
org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:531)
        at 
org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:502)
        at 
org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:309)
        at 
org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:219)
        at 
org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java:80)
        ... 8 more
Caused by: java.lang.NullPointerException
        at 
org.apache.axis2.schema.writer.CStructWriter.addPropertyEntries(CStructWriter.java:635)
        at 
org.apache.axis2.schema.writer.CStructWriter.populateInfo(CStructWriter.java:516)
        at 
org.apache.axis2.schema.writer.CStructWriter.getBeanElement(CStructWriter.java:439)
        at 
org.apache.axis2.schema.writer.CStructWriter.process(CStructWriter.java:320)
        at 
org.apache.axis2.schema.writer.CStructWriter.write(CStructWriter.java:192)
        ... 29 more

I receive this failure both with the WSDL2C released in Axis2-1.3 and in the 
current nightly build I downloaded yesterday.  Of course, it is a little 
difficult to isolate what in the WSDL is causing the failure, as no stub code 
is generated that might hint at the problem area.  The same WSDL is accepted by 
the Axis2 WSDL2Java utility, so the issue is specific to C code generation.  As 
the WSDL2Java utility accepts the file, this suggests that the WSDL itself is 
valid.  If -d none is specified on the command line, the WSDL2C utility runs to 
completion, so the issue is specific to the generation of the C data bindings.  

The contents of service.wsdl are:
<?xml version="1.0"?>
<definitions xmlns:fw="http://frameware.xcentrisity.com/services/"; 
xmlns="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:ns="http://www.w3.org/2001/XMLSchema"; 
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
targetNamespace="http://frameware.xcentrisity.com/services/"; name="Frameware" 
ns:schemaLocation="http://schemas.xmlsoap.org/wsdl/ 
http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd";>
        <types>
                <schema 
targetNamespace="http://frameware.xcentrisity.com/services/"; 
xmlns="http://www.w3.org/2001/XMLSchema";>
                        <complexType name="ModelType">
                                <sequence>
                                        <any namespace="##local" minOccurs="1" 
maxOccurs="1"/>
                                </sequence>
                        </complexType>
                        <complexType name="ExemplarType">
                                <complexContent>
                                        <extension base="fw:ModelType">
                                                <attribute name="handle" 
type="string" use="required"/>
                                        </extension>
                                </complexContent>
                        </complexType>
                        <complexType name="InstanceType">
                                <complexContent>
                                        <extension base="fw:ModelType">
                                                <attribute name="handle" 
type="string" use="required"/>
                                        </extension>
                                </complexContent>
                        </complexType>
                        <complexType name="getExemplarType">
                                <attribute name="name" type="string" 
use="required"/>
                                <attribute name="exemplarHandle" type="string" 
use="required"/>
                        </complexType>
                        <complexType name="getExemplarResponseType">
                                <complexContent>
                                        <restriction base="anyType">
                                                <sequence>
                                                        <element 
name="exemplar" type="fw:ExemplarType"/>
                                                </sequence>
                                                <attributeGroup 
ref="fw:ResponseAttributeGroup"/>
                                                <attribute 
name="supportedMethods" type="fw:MethodListType" use="optional"/>
                                        </restriction>
                                </complexContent>
                        </complexType>
                        <complexType name="BrowseResponseType">
                                <complexContent>
                                        <restriction base="anyType">
                                                <sequence>
                                                        <element 
name="instance" type="fw:InstanceType" minOccurs="0" maxOccurs="unbounded"/>
                                                </sequence>
                                                <attributeGroup 
ref="fw:ResponseAttributeGroup"/>
                                        </restriction>
                                </complexContent>
                        </complexType>
                        <complexType name="BrowseConditionsType">
                                <complexContent>
                                        <restriction base="anyType">
                                                <sequence>
                                                        <element 
name="conditionInstance" maxOccurs="unbounded">
                                                                <complexType>
                                                                        
<complexContent>
                                                                                
<extension base="fw:ModelType">
                                                                                
        <attribute name="termIndex" type="unsignedInt" use="optional" 
default="1"/>
                                                                                
        <attribute name="term-index" type="unsignedInt" use="optional" 
default="1"/>
                                                                                
        <attribute name="constraint" type="string" use="required"/>
                                                                                
</extension>
                                                                        
</complexContent>
                                                                </complexType>
                                                        </element>
                                                </sequence>
                                                <attribute name="name" 
type="string" use="required"/>
                                                <attribute name="limit" 
type="unsignedInt" use="optional"/>
                                                <attribute 
name="exemplarHandle" type="string" use="required"/>
                                                <attribute name="handle" 
type="string" use="optional"/>
                                                <attribute name="userId" 
type="string" use="optional"/>
                                                <attribute name="userName" 
type="string" use="optional"/>
                                        </restriction>
                                </complexContent>
                        </complexType>
                        <complexType name="CreateType">
                                <complexContent>
                                        <restriction base="anyType">
                                                <sequence>
                                                        <element 
name="instance" type="fw:ModelType"/>
                                                </sequence>
                                                <attribute name="name" 
type="string" use="required"/>
                                                <attribute name="limit" 
type="unsignedInt" use="optional"/>
                                                <attribute name="handle" 
type="string" use="optional"/>
                                                <attribute 
name="exemplarHandle" type="string" use="required"/>
                                                <attribute name="userId" 
type="string" use="optional"/>
                                                <attribute name="userName" 
type="string" use="optional"/>
                                        </restriction>
                                </complexContent>
                        </complexType>
                        <complexType name="RetrieveType">
                                <attribute name="name" type="string" 
use="required"/>
                                <attribute name="handle" type="string" 
use="required"/>
                                <attribute name="limit" type="unsignedInt" 
use="optional"/>
                                <attribute name="exemplarHandle" type="string" 
use="required"/>
                                <attribute name="userId" type="string" 
use="optional"/>
                                <attribute name="userName" type="string" 
use="optional"/>
                        </complexType>
                        <complexType name="UpdateType">
                                <complexContent>
                                        <restriction base="anyType">
                                                <sequence>
                                                        <element 
name="instance" type="fw:ModelType"/>
                                                </sequence>
                                                <attribute name="name" 
type="string" use="required"/>
                                                <attribute name="limit" 
type="unsignedInt" use="optional"/>
                                                <attribute name="handle" 
type="string" use="required"/>
                                                <attribute 
name="exemplarHandle" type="string" use="required"/>
                                                <attribute name="userId" 
type="string" use="optional"/>
                                                <attribute name="userName" 
type="string" use="optional"/>
                                        </restriction>
                                </complexContent>
                        </complexType>
                        <complexType name="DeleteType">
                                <attribute name="name" type="string" 
use="required"/>
                                <attribute name="handle" type="string" 
use="required"/>
                                <attribute name="exemplarHandle" type="string" 
use="required"/>
                                <attribute name="userId" type="string" 
use="optional"/>
                                <attribute name="userName" type="string" 
use="optional"/>
                        </complexType>
                        <complexType name="StatusResponseType">
                                <attributeGroup 
ref="fw:ResponseAttributeGroup"/>
                        </complexType>
                        <complexType name="InstanceResponseType">
                                <complexContent>
                                        <restriction base="anyType">
                                                <sequence>
                                                        <element 
name="instance" type="fw:InstanceType" minOccurs="0" maxOccurs="1"/>
                                                </sequence>
                                                <attributeGroup 
ref="fw:ResponseAttributeGroup"/>
                                        </restriction>
                                </complexContent>
                        </complexType>
                        <simpleType name="MethodListType">
                                <list itemType="string"/>
                        </simpleType>
                        <attributeGroup name="ResponseAttributeGroup">
                                <attribute name="responseCode" type="integer" 
use="optional" default="0"/>
                                <attribute name="responseMessage" type="string" 
use="optional"/>
                        </attributeGroup>
                        <element name="getExemplar" type="fw:getExemplarType"/>
                        <element name="getExemplarResponse" 
type="fw:getExemplarResponseType"/>
                        <element name="browse" type="fw:BrowseConditionsType"/>
                        <element name="browseResponse" 
type="fw:BrowseResponseType"/>
                        <element name="browseNext" 
type="fw:BrowseConditionsType"/>
                        <element name="browseNextResponse" 
type="fw:BrowseResponseType"/>
                        <element name="browsePrevious" 
type="fw:BrowseConditionsType"/>
                        <element name="browsePreviousResponse" 
type="fw:BrowseResponseType"/>
                        <element name="create" type="fw:CreateType"/>
                        <element name="createResponse" 
type="fw:InstanceResponseType"/>
                        <element name="retrieve" type="fw:RetrieveType"/>
                        <element name="retrieveResponse" 
type="fw:InstanceResponseType"/>
                        <element name="update" type="fw:UpdateType"/>
                        <element name="updateResponse" 
type="fw:InstanceResponseType"/>
                        <element name="delete" type="fw:DeleteType"/>
                        <element name="deleteResponse" 
type="fw:StatusResponseType"/>
                </schema>
        </types>
        <message name="getExemplarRequest">
                <part name="getExemplarRequest" element="fw:getExemplar"/>
        </message>
        <message name="getExemplarResponse">
                <part name="getExemplarResponse" 
element="fw:getExemplarResponse"/>
        </message>
        <message name="browseRequest">
                <part name="browseRequest" element="fw:browse"/>
        </message>
        <message name="browseResponse">
                <part name="browseResponse" element="fw:browseResponse"/>
        </message>
        <message name="browseNextRequest">
                <part name="browseNext" element="fw:browseNext"/>
        </message>
        <message name="browseNextResponse">
                <part name="browseNextResponse" 
element="fw:browseNextResponse"/>
        </message>
        <message name="browsePreviousRequest">
                <part name="browsePrevious" element="fw:browsePrevious"/>
        </message>
        <message name="browsePreviousResponse">
                <part name="browsePreviousResponse" 
element="fw:browsePreviousResponse"/>
        </message>
        <message name="createRequest">
                <part name="create" element="fw:create"/>
        </message>
        <message name="createResponse">
                <part name="createResponse" element="fw:createResponse"/>
        </message>
        <message name="retrieveRequest">
                <part name="retrieve" element="fw:retrieve"/>
        </message>
        <message name="retrieveResponse">
                <part name="retrieveResponse" element="fw:retrieveResponse"/>
        </message>
        <message name="updateRequest">
                <part name="updateRequest" element="fw:update"/>
        </message>
        <message name="updateResponse">
                <part name="updateResponse" element="fw:updateResponse"/>
        </message>
        <message name="deleteRequest">
                <part name="deleteRequest" element="fw:delete"/>
        </message>
        <message name="deleteResponse">
                <part name="deleteResponse" element="fw:deleteResponse"/>
        </message>
        <portType name="IFramewareService">
                <operation name="getExemplar">
                        <input message="fw:getExemplarRequest"/>
                        <output message="fw:getExemplarResponse"/>
                </operation>
                <operation name="browse">
                        <input message="fw:browseRequest"/>
                        <output message="fw:browseResponse"/>
                </operation>
                <operation name="browseNext">
                        <input message="fw:browseNextRequest"/>
                        <output message="fw:browseNextResponse"/>
                </operation>
                <operation name="browsePrevious">
                        <input message="fw:browsePreviousRequest"/>
                        <output message="fw:browsePreviousResponse"/>
                </operation>
                <operation name="create">
                        <input message="fw:createRequest"/>
                        <output message="fw:createResponse"/>
                </operation>
                <operation name="retrieve">
                        <input message="fw:retrieveRequest"/>
                        <output message="fw:retrieveResponse"/>
                </operation>
                <operation name="update">
                        <input message="fw:updateRequest"/>
                        <output message="fw:updateResponse"/>
                </operation>
                <operation name="delete">
                        <input message="fw:deleteRequest"/>
                        <output message="fw:deleteResponse"/>
                </operation>
        </portType>
        <binding name="FramewareSoapBinding" type="fw:IFramewareService">
                <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
                <operation name="getExemplar">
                        <soap:operation 
soapAction="http://services.xcentrisity.com/frameware/getExemplar"/>
                        <input>
                                <soap:body use="literal"/>
                        </input>
                        <output>
                                <soap:body use="literal"/>
                        </output>
                </operation>
                <operation name="browse">
                        <soap:operation 
soapAction="http://services.xcentrisity.com/frameware/browse"/>
                        <input>
                                <soap:body use="literal"/>
                        </input>
                        <output>
                                <soap:body use="literal"/>
                        </output>
                </operation>
                <operation name="browseNext">
                        <soap:operation 
soapAction="http://services.xcentrisity.com/frameware/browseNext"/>
                        <input>
                                <soap:body use="literal"/>
                        </input>
                        <output>
                                <soap:body use="literal"/>
                        </output>
                </operation>
                <operation name="browsePrevious">
                        <soap:operation 
soapAction="http://services.xcentrisity.com/frameware/browsePrevious"/>
                        <input>
                                <soap:body use="literal"/>
                        </input>
                        <output>
                                <soap:body use="literal"/>
                        </output>
                </operation>
                <operation name="create">
                        <soap:operation 
soapAction="http://services.xcentrisity.com/frameware/create"/>
                        <input>
                                <soap:body use="literal"/>
                        </input>
                        <output>
                                <soap:body use="literal"/>
                        </output>
                </operation>
                <operation name="retrieve">
                        <soap:operation 
soapAction="http://services.xcentrisity.com/frameware/retrieve"/>
                        <input>
                                <soap:body use="literal"/>
                        </input>
                        <output>
                                <soap:body use="literal"/>
                        </output>
                </operation>
                <operation name="update">
                        <soap:operation 
soapAction="http://services.xcentrisity.com/frameware/update"/>
                        <input>
                                <soap:body use="literal"/>
                        </input>
                        <output>
                                <soap:body use="literal"/>
                        </output>
                </operation>
                <operation name="delete">
                        <soap:operation 
soapAction="http://services.xcentrisity.com/frameware/delete"/>
                        <input>
                                <soap:body use="literal"/>
                        </input>
                        <output>
                                <soap:body use="literal"/>
                        </output>
                </operation>
        </binding>
        <service name="FramewareService">
                <port name="FramewareServicePort" 
binding="fw:FramewareSoapBinding">
                        <soap:address 
location="http://localhost/Frameware/customers/customers.srf"/>
                </port>
        </service>
</definitions>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to