I have a class "DataObjectConcrete" that extends from a base abstract class
"DataObjectAbstract". My Axis-client calls a method which returns class
"DataObjectConcrete". The method is called and processed correctly, but during
the response deserialization Axis tries to instantiate the abstract class
"DataObjectAbstract" instead of the concrete class "DataObjectConcrete".

My client receives the following error message :

0 [main] ERROR client.Call  - Exception:
org.xml.sax.SAXException: Unable to create JavaBean of type
com.xxx.xxx.xxx.DataObjectAbstract.  Missing default constructor?  Error was:
java.lang.InstantiationException: com.xxx.xxx.xxx.DataObjectAbstract.
     at
org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:159)
     at
org.apache.axis.encoding.DeserializerImpl.onStartElement(DeserializerImpl.java:481)...


In the WSDL (generated by java2wsdl) this class is defined as

   <complexType abstract="true" name="DataObjectAbstract">
    <sequence>
     <element name="action" type="xsd:int"/>
    </sequence>
   </complexType>

the concrete class is defined as

   <complexType name="DataObjectConcrete">
    <complexContent>
     <extension base="tns3:DataObjectAbstract">
      <sequence>
       <...>
      </sequence>
     </extension>
    </complexContent>
   </complexType>

wsdl2java generates a stub where the abstract class is defined as

    qName =
      new javax.xml.namespace.QName(
        "http://xxx.xxx.xxx.com";,
        "DataObjectAbstract");
    cachedSerQNames.add(qName);
    cls = com.xxx.xxx.xxx.DataObjectAbstract.class;
    cachedSerClasses.add(cls);
    cachedSerFactories.add(beansf);
    cachedDeserFactories.add(beandf);

the concrete class is defined in the same way. We are using the default
serializers and deserializers.

What has to be done in order for Axis to instantiate the concrete class during
deserialization?

Thanks in advance


Reply via email to