You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Lorenzo Dini <Lo...@cern.ch> on 2007/03/20 21:46:04 UTC

Problem on inheritance

Dear axis2 support,

I am quite new on this technology and I would like to ask you a question on
class inheritance.

I would like to have a method in the ws interface returning a generic type
(A in the example) and then runtime return a subclass of that generic class
(B I the example).

I also take care that the subclasses on exposed in the interface are
included in the WSDL.

I tried with several technologies available in AXIS2 without succeed:

POJO: even if the automatically generated WSDL is fine (A with a and B with
a and b), when I try to return a subclass B instead of the generic class A,
only variables defined in the subclass B are present in the SOAP message. Is
the system using the wsdl to call getters and setters or it is finding no
method "setA()" in the B class and therefore is not calling it?

ADB and XMLBEANS: Generating the code, The class B does not extend the class
A so I cannot set an instance of B in the return class defined as A. Of
course A does not contain setters and getters for its subclasses.

Can you please tell me where I am making mistakes??

This is the implementation class:

==================================================
public class TestServiceImpl{

    public A getA(){
        A a = new A();
        a.setA("a");
        return a;
    }

    public A getBunderA(){
        B b = new B();
        b.setA("a");
        b.setB("b");
        return b;
    }

    public B getB(){
        B b = new B();
        b.setA("a");
        b.setB("b");
        return b;
    }
}
==================================================

With the following classes:

==================================================
public class A {

    String a;

    public String getA() {
        return a;
    }

    public void setA(String a) {
        this.a = a;
    }
}

public class B extends A {
    String b;

    public String getB() {
        return b;
    }

    public void setB(String b) {
        this.b = b;
    }
}
==================================================

Thank you very much!

Lorenzo.

--
 
Lorenzo Dini

CERN ­ European Organization for Nuclear Research
Information Technology Department
CH-1211 Geneva 23  

Building 31 - Office S-021
Phone: +41 (0) 22 7672013
Fax: +41 (0) 22 7668847
E-mail: Lorenzo.Dini@cern.ch




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Problem on inheritance

Posted by Amila Suriarachchi <am...@gmail.com>.
<wsdl:definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
                  xmlns:xsd="http://test/xsd" xmlns:ns="http://test"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://test">
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   xmlns:tns="http://test/xsd"
                   attributeFormDefault="qualified"
                   elementFormDefault="qualified" targetNamespace="
http://test/xsd">

            <xs:complexType name="parentType">
                <xs:sequence>
                    <xs:element name="param1" type="xs:int"/>
                    <xs:element name="param2" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:complexType name="childType">
                <xs:complexContent>
                    <xs:extension base="tns:parentType" >
                        <xs:sequence>
                            <xs:element name="param3" type="xs:string"/>
                            <xs:element name="param4" type="xs:int"/>
                        </xs:sequence>
                    </xs:extension>
                </xs:complexContent>
            </xs:complexType>
            <xs:element name="element1" >
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="param5" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="element2" type="tns:parentType"></xs:element>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="intTestMessage">
        <wsdl:part name="part1" element="xsd:element1"/>
    </wsdl:message>
    <wsdl:message name="intTestResponseMessage">
        <wsdl:part name="part1" element="xsd:element2"/>
    </wsdl:message>
    <wsdl:portType name="TestPortType">
        <wsdl:operation name="intTest">
            <wsdl:input message="ns:intTestMessage"/>
            <wsdl:output message="ns:intTestResponseMessage"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="TestSOAP11Binding" type="ns:TestPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
        <wsdl:operation name="intTest">
            <soap:operation soapAction="urn:intTest" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Test">
        <wsdl:port name="TestSOAP11port" binding="ns:TestSOAP11Binding">
            <soap:address location="
http://localhost:8080/axis2/services/Test"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

here is a solution came to my mind.
use -ss -sd -g -uw options to genrate code with wsdl2java

On 3/21/07, Lorenzo Dini <Lo...@cern.ch> wrote:
>
>  Hi guys,
>
> I still have this problem on inheritance... could you help me? Sorry but
> this is blocking and I am quite late :-(
>
> I want simply to have a method in the web service interface like:
>
> public A getA(){
>     return new B();
> }
>
> where B extends A.
>
> The WSDL is generated including all the attributes of the type A in the B
> type definition. This is fine.
>
> If i try to do it with POJO only B specific attributes are included in the
> SOAP return message.
> Maybe because the system cannot find getters and setters for A's
> attributes in B....
>
> With ADB and XMLBEANS generated code, the mothod getA() must return a type
> A... but this class includes only A's attributes.
>
> How do I solve this problem?
>
> Thanks.
>
> Lorenzo
>
> P.S. I attached the previous message I got no answer.
>
>
> Lorenzo Dini ha scritto:
>
> Dear axis2 support,
>
> I am quite new on this technology and I would like to ask you a question on
> class inheritance.
>
> I would like to have a method in the ws interface returning a generic type
> (A in the example) and then runtime return a subclass of that generic class
> (B I the example).
>
> I also take care that the subclasses on exposed in the interface are
> included in the WSDL.
>
> I tried with several technologies available in AXIS2 without succeed:
>
> POJO: even if the automatically generated WSDL is fine (A with a and B with
> a and b), when I try to return a subclass B instead of the generic class A,
> only variables defined in the subclass B are present in the SOAP message. Is
> the system using the wsdl to call getters and setters or it is finding no
> method "setA()" in the B class and therefore is not calling it?
>
> ADB and XMLBEANS: Generating the code, The class B does not extend the class
> A so I cannot set an instance of B in the return class defined as A. Of
> course A does not contain setters and getters for its subclasses.
>
> Can you please tell me where I am making mistakes??
>
> This is the implementation class:
>
> ==================================================
> public class TestServiceImpl{
>
>     public A getA(){
>         A a = new A();
>         a.setA("a");
>         return a;
>     }
>
>     public A getBunderA(){
>         B b = new B();
>         b.setA("a");
>         b.setB("b");
>         return b;
>     }
>
>     public B getB(){
>         B b = new B();
>         b.setA("a");
>         b.setB("b");
>         return b;
>     }
> }
> ==================================================
>
> With the following classes:
>
> ==================================================
> public class A {
>
>     String a;
>
>     public String getA() {
>         return a;
>     }
>
>     public void setA(String a) {
>         this.a = a;
>     }
> }
>
> public class B extends A {
>     String b;
>
>     public String getB() {
>         return b;
>     }
>
>     public void setB(String b) {
>         this.b = b;
>     }
> }
> ==================================================
>
> Thank you very much!
>
> Lorenzo.
>
> --
>
> Lorenzo Dini
>
> CERN ­ European Organization for Nuclear Research
> Information Technology Department
> CH-1211 Geneva 23
>
> Building 31 - Office S-021
> Phone: +41 (0) 22 7672013
> Fax: +41 (0) 22 7668847
> E-mail: Lorenzo.Dini@cern.ch
>
>
>
> --
>
>  *Lorenzo Dini*
>     CERN – European Organization for Nuclear Research
> Information Technology Department
> CH-1211 Geneva 23
>
>  Building 31 - Office S-021
> Phone: +41 (0) 22 7672013
> Fax: +41 (0) 22 7668847
> E-mail: Lorenzo.Dini@cern.ch
>



-- 
Amila Suriarachchi,
WSO2 Inc.

Re: Problem on inheritance

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Can you please create a JIRA and attach you test classes to re-generate
the issue.

Thanks
Deepal

Lorenzo Dini wrote:

> Hi,
>
> to solve the POJO subclass attributes problem I tried the nighly build
> 21/03/2007
>
> I replaced all the old axis2-*.jar with the new axis2-*-SNAPSHOT.jar
>
> is it correct? because now I have this error just after the startUp()
> call:
>
> java.lang.IllegalArgumentException: prefix cannot be "null" when
> creating a QName
>
> i dunno whether a new bug has been introduced or there are new
> constraints in the new version that weren't present in the 1.1.1.
>
> Any ideas??
>
> Thanks
>
> Lorenzo
>
> Deepal Jayasinghe ha scritto:
>
>>Hi Lorenzo ;
>>
>>I just made the changes, pls try today's nightly build then you will be
>>able to solve the POJO issue.
>>
>>Thanks
>>Deepal
>>
>>  
>>
>>>Hi guys,
>>>
>>>I still have this problem on inheritance... could you help me? Sorry
>>>but this is blocking and I am quite late :-(
>>>
>>>I want simply to have a method in the web service interface like:
>>>
>>>public A getA(){
>>>return new B();
>>>}
>>>
>>>where B extends A.
>>>
>>>The WSDL is generated including all the attributes of the type A in
>>>the B type definition. This is fine.
>>>
>>>If i try to do it with POJO only B specific attributes are included in
>>>the SOAP return message.
>>>Maybe because the system cannot find getters and setters for A's
>>>attributes in B....
>>>
>>>With ADB and XMLBEANS generated code, the mothod getA() must return a
>>>type A... but this class includes only A's attributes.
>>>
>>>How do I solve this problem?
>>>
>>>Thanks.
>>>
>>>Lorenzo
>>>
>>>P.S. I attached the previous message I got no answer.
>>>
>>>
>>>Lorenzo Dini ha scritto:
>>>
>>>    
>>>
>>>>Dear axis2 support,
>>>>
>>>>I am quite new on this technology and I would like to ask you a question on
>>>>class inheritance.
>>>>
>>>>I would like to have a method in the ws interface returning a generic type
>>>>(A in the example) and then runtime return a subclass of that generic class
>>>>(B I the example).
>>>>
>>>>I also take care that the subclasses on exposed in the interface are
>>>>included in the WSDL.
>>>>
>>>>I tried with several technologies available in AXIS2 without succeed:
>>>>
>>>>POJO: even if the automatically generated WSDL is fine (A with a and B with
>>>>a and b), when I try to return a subclass B instead of the generic class A,
>>>>only variables defined in the subclass B are present in the SOAP message. Is
>>>>the system using the wsdl to call getters and setters or it is finding no
>>>>method "setA()" in the B class and therefore is not calling it?
>>>>
>>>>ADB and XMLBEANS: Generating the code, The class B does not extend the class
>>>>A so I cannot set an instance of B in the return class defined as A. Of
>>>>course A does not contain setters and getters for its subclasses.
>>>>
>>>>Can you please tell me where I am making mistakes??
>>>>
>>>>This is the implementation class:
>>>>
>>>>==================================================
>>>>public class TestServiceImpl{
>>>>
>>>>   public A getA(){
>>>>       A a = new A();
>>>>       a.setA("a");
>>>>       return a;
>>>>   }
>>>>
>>>>   public A getBunderA(){
>>>>       B b = new B();
>>>>       b.setA("a");
>>>>       b.setB("b");
>>>>       return b;
>>>>   }
>>>>
>>>>   public B getB(){
>>>>       B b = new B();
>>>>       b.setA("a");
>>>>       b.setB("b");
>>>>       return b;
>>>>   }
>>>>}
>>>>==================================================
>>>>
>>>>With the following classes:
>>>>
>>>>==================================================
>>>>public class A {
>>>>
>>>>   String a;
>>>>
>>>>   public String getA() {
>>>>       return a;
>>>>   }
>>>>
>>>>   public void setA(String a) {
>>>>       this.a = a;
>>>>   }
>>>>}
>>>>
>>>>public class B extends A {
>>>>   String b;
>>>>
>>>>   public String getB() {
>>>>       return b;
>>>>   }
>>>>
>>>>   public void setB(String b) {
>>>>       this.b = b;
>>>>   }
>>>>}
>>>>==================================================
>>>>
>>>>Thank you very much!
>>>>
>>>>Lorenzo.
>>>>
>>>>--
>>>>
>>>>Lorenzo Dini
>>>>
>>>>CERN ­ European Organization for Nuclear Research
>>>>Information Technology Department
>>>>CH-1211 Geneva 23  
>>>>
>>>>Building 31 - Office S-021
>>>>Phone: +41 (0) 22 7672013
>>>>Fax: +41 (0) 22 7668847
>>>>E-mail: Lorenzo.Dini@cern.ch
>>>>
>>>>
>>>> 
>>>>
>>>>      
>>>>
>>>-- 
>>>
>>>*Lorenzo Dini*
>>>
>>>CERN – European Organization for Nuclear Research
>>>Information Technology Department
>>>CH-1211 Geneva 23
>>>
>>>Building 31 - Office S-021
>>>Phone: +41 (0) 22 7672013
>>>Fax: +41 (0) 22 7668847
>>>E-mail: Lorenzo.Dini@cern.ch
>>>
>>>    
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>  
>>
>
> -- 
>
> *Lorenzo Dini*
>
> CERN – European Organization for Nuclear Research
> Information Technology Department
> CH-1211 Geneva 23 
>
> Building 31 - Office S-021
> Phone: +41 (0) 22 7672013
> Fax: +41 (0) 22 7668847
> E-mail: Lorenzo.Dini@cern.ch
>

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Problem on inheritance

Posted by Lorenzo Dini <Lo...@cern.ch>.
Hi,

to solve the POJO subclass attributes problem I tried the nighly build 
21/03/2007

I replaced all the old axis2-*.jar with the new axis2-*-SNAPSHOT.jar

is it correct? because now I have this error just after the startUp() call:

java.lang.IllegalArgumentException: prefix cannot be "null" when 
creating a QName


i dunno whether a new bug has been introduced or there are new 
constraints in the new version that weren't present in the 1.1.1.

Any ideas??

Thanks

Lorenzo

Deepal Jayasinghe ha scritto:
> Hi Lorenzo ;
>
> I just made the changes, pls try today's nightly build then you will be
> able to solve the POJO issue.
>
> Thanks
> Deepal
>
>   
>> Hi guys,
>>
>> I still have this problem on inheritance... could you help me? Sorry
>> but this is blocking and I am quite late :-(
>>
>> I want simply to have a method in the web service interface like:
>>
>> public A getA(){
>> return new B();
>> }
>>
>> where B extends A.
>>
>> The WSDL is generated including all the attributes of the type A in
>> the B type definition. This is fine.
>>
>> If i try to do it with POJO only B specific attributes are included in
>> the SOAP return message.
>> Maybe because the system cannot find getters and setters for A's
>> attributes in B....
>>
>> With ADB and XMLBEANS generated code, the mothod getA() must return a
>> type A... but this class includes only A's attributes.
>>
>> How do I solve this problem?
>>
>> Thanks.
>>
>> Lorenzo
>>
>> P.S. I attached the previous message I got no answer.
>>
>>
>> Lorenzo Dini ha scritto:
>>
>>     
>>> Dear axis2 support,
>>>
>>> I am quite new on this technology and I would like to ask you a question on
>>> class inheritance.
>>>
>>> I would like to have a method in the ws interface returning a generic type
>>> (A in the example) and then runtime return a subclass of that generic class
>>> (B I the example).
>>>
>>> I also take care that the subclasses on exposed in the interface are
>>> included in the WSDL.
>>>
>>> I tried with several technologies available in AXIS2 without succeed:
>>>
>>> POJO: even if the automatically generated WSDL is fine (A with a and B with
>>> a and b), when I try to return a subclass B instead of the generic class A,
>>> only variables defined in the subclass B are present in the SOAP message. Is
>>> the system using the wsdl to call getters and setters or it is finding no
>>> method "setA()" in the B class and therefore is not calling it?
>>>
>>> ADB and XMLBEANS: Generating the code, The class B does not extend the class
>>> A so I cannot set an instance of B in the return class defined as A. Of
>>> course A does not contain setters and getters for its subclasses.
>>>
>>> Can you please tell me where I am making mistakes??
>>>
>>> This is the implementation class:
>>>
>>> ==================================================
>>> public class TestServiceImpl{
>>>
>>>    public A getA(){
>>>        A a = new A();
>>>        a.setA("a");
>>>        return a;
>>>    }
>>>
>>>    public A getBunderA(){
>>>        B b = new B();
>>>        b.setA("a");
>>>        b.setB("b");
>>>        return b;
>>>    }
>>>
>>>    public B getB(){
>>>        B b = new B();
>>>        b.setA("a");
>>>        b.setB("b");
>>>        return b;
>>>    }
>>> }
>>> ==================================================
>>>
>>> With the following classes:
>>>
>>> ==================================================
>>> public class A {
>>>
>>>    String a;
>>>
>>>    public String getA() {
>>>        return a;
>>>    }
>>>
>>>    public void setA(String a) {
>>>        this.a = a;
>>>    }
>>> }
>>>
>>> public class B extends A {
>>>    String b;
>>>
>>>    public String getB() {
>>>        return b;
>>>    }
>>>
>>>    public void setB(String b) {
>>>        this.b = b;
>>>    }
>>> }
>>> ==================================================
>>>
>>> Thank you very much!
>>>
>>> Lorenzo.
>>>
>>> --
>>>
>>> Lorenzo Dini
>>>
>>> CERN ­ European Organization for Nuclear Research
>>> Information Technology Department
>>> CH-1211 Geneva 23  
>>>
>>> Building 31 - Office S-021
>>> Phone: +41 (0) 22 7672013
>>> Fax: +41 (0) 22 7668847
>>> E-mail: Lorenzo.Dini@cern.ch
>>>
>>>
>>>  
>>>
>>>       
>> -- 
>>
>> *Lorenzo Dini*
>>
>> CERN – European Organization for Nuclear Research
>> Information Technology Department
>> CH-1211 Geneva 23
>>
>> Building 31 - Office S-021
>> Phone: +41 (0) 22 7672013
>> Fax: +41 (0) 22 7668847
>> E-mail: Lorenzo.Dini@cern.ch
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>   

-- 

*Lorenzo Dini*

CERN – European Organization for Nuclear Research
Information Technology Department
CH-1211 Geneva 23 

Building 31 - Office S-021
Phone: +41 (0) 22 7672013
Fax: +41 (0) 22 7668847
E-mail: Lorenzo.Dini@cern.ch


Re: Problem on inheritance

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Lorenzo ;

I just made the changes, pls try today's nightly build then you will be
able to solve the POJO issue.

Thanks
Deepal

> Hi guys,
>
> I still have this problem on inheritance... could you help me? Sorry
> but this is blocking and I am quite late :-(
>
> I want simply to have a method in the web service interface like:
>
> public A getA(){
> return new B();
> }
>
> where B extends A.
>
> The WSDL is generated including all the attributes of the type A in
> the B type definition. This is fine.
>
> If i try to do it with POJO only B specific attributes are included in
> the SOAP return message.
> Maybe because the system cannot find getters and setters for A's
> attributes in B....
>
> With ADB and XMLBEANS generated code, the mothod getA() must return a
> type A... but this class includes only A's attributes.
>
> How do I solve this problem?
>
> Thanks.
>
> Lorenzo
>
> P.S. I attached the previous message I got no answer.
>
>
> Lorenzo Dini ha scritto:
>
>>Dear axis2 support,
>>
>>I am quite new on this technology and I would like to ask you a question on
>>class inheritance.
>>
>>I would like to have a method in the ws interface returning a generic type
>>(A in the example) and then runtime return a subclass of that generic class
>>(B I the example).
>>
>>I also take care that the subclasses on exposed in the interface are
>>included in the WSDL.
>>
>>I tried with several technologies available in AXIS2 without succeed:
>>
>>POJO: even if the automatically generated WSDL is fine (A with a and B with
>>a and b), when I try to return a subclass B instead of the generic class A,
>>only variables defined in the subclass B are present in the SOAP message. Is
>>the system using the wsdl to call getters and setters or it is finding no
>>method "setA()" in the B class and therefore is not calling it?
>>
>>ADB and XMLBEANS: Generating the code, The class B does not extend the class
>>A so I cannot set an instance of B in the return class defined as A. Of
>>course A does not contain setters and getters for its subclasses.
>>
>>Can you please tell me where I am making mistakes??
>>
>>This is the implementation class:
>>
>>==================================================
>>public class TestServiceImpl{
>>
>>    public A getA(){
>>        A a = new A();
>>        a.setA("a");
>>        return a;
>>    }
>>
>>    public A getBunderA(){
>>        B b = new B();
>>        b.setA("a");
>>        b.setB("b");
>>        return b;
>>    }
>>
>>    public B getB(){
>>        B b = new B();
>>        b.setA("a");
>>        b.setB("b");
>>        return b;
>>    }
>>}
>>==================================================
>>
>>With the following classes:
>>
>>==================================================
>>public class A {
>>
>>    String a;
>>
>>    public String getA() {
>>        return a;
>>    }
>>
>>    public void setA(String a) {
>>        this.a = a;
>>    }
>>}
>>
>>public class B extends A {
>>    String b;
>>
>>    public String getB() {
>>        return b;
>>    }
>>
>>    public void setB(String b) {
>>        this.b = b;
>>    }
>>}
>>==================================================
>>
>>Thank you very much!
>>
>>Lorenzo.
>>
>>--
>> 
>>Lorenzo Dini
>>
>>CERN ­ European Organization for Nuclear Research
>>Information Technology Department
>>CH-1211 Geneva 23  
>>
>>Building 31 - Office S-021
>>Phone: +41 (0) 22 7672013
>>Fax: +41 (0) 22 7668847
>>E-mail: Lorenzo.Dini@cern.ch
>>
>>
>>  
>>
>
> -- 
>
> *Lorenzo Dini*
>
> CERN – European Organization for Nuclear Research
> Information Technology Department
> CH-1211 Geneva 23
>
> Building 31 - Office S-021
> Phone: +41 (0) 22 7672013
> Fax: +41 (0) 22 7668847
> E-mail: Lorenzo.Dini@cern.ch
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Problem on inheritance

Posted by Lorenzo Dini <Lo...@cern.ch>.
Hi guys,

I still have this problem on inheritance... could you help me? Sorry but 
this is blocking and I am quite late :-(

I want simply to have a method in the web service interface like:

public A getA(){
    return new B();
}

where B extends A.

The WSDL is generated including all the attributes of the type A in the 
B type definition. This is fine.

If i try to do it with POJO only B specific attributes are included in 
the SOAP return message.
Maybe because the system cannot find getters and setters for A's 
attributes in B....

With ADB and XMLBEANS generated code, the mothod getA() must return a 
type A... but this class includes only A's attributes.

How do I solve this problem?

Thanks.

Lorenzo

P.S. I attached the previous message I got no answer.


Lorenzo Dini ha scritto:
> Dear axis2 support,
>
> I am quite new on this technology and I would like to ask you a question on
> class inheritance.
>
> I would like to have a method in the ws interface returning a generic type
> (A in the example) and then runtime return a subclass of that generic class
> (B I the example).
>
> I also take care that the subclasses on exposed in the interface are
> included in the WSDL.
>
> I tried with several technologies available in AXIS2 without succeed:
>
> POJO: even if the automatically generated WSDL is fine (A with a and B with
> a and b), when I try to return a subclass B instead of the generic class A,
> only variables defined in the subclass B are present in the SOAP message. Is
> the system using the wsdl to call getters and setters or it is finding no
> method "setA()" in the B class and therefore is not calling it?
>
> ADB and XMLBEANS: Generating the code, The class B does not extend the class
> A so I cannot set an instance of B in the return class defined as A. Of
> course A does not contain setters and getters for its subclasses.
>
> Can you please tell me where I am making mistakes??
>
> This is the implementation class:
>
> ==================================================
> public class TestServiceImpl{
>
>     public A getA(){
>         A a = new A();
>         a.setA("a");
>         return a;
>     }
>
>     public A getBunderA(){
>         B b = new B();
>         b.setA("a");
>         b.setB("b");
>         return b;
>     }
>
>     public B getB(){
>         B b = new B();
>         b.setA("a");
>         b.setB("b");
>         return b;
>     }
> }
> ==================================================
>
> With the following classes:
>
> ==================================================
> public class A {
>
>     String a;
>
>     public String getA() {
>         return a;
>     }
>
>     public void setA(String a) {
>         this.a = a;
>     }
> }
>
> public class B extends A {
>     String b;
>
>     public String getB() {
>         return b;
>     }
>
>     public void setB(String b) {
>         this.b = b;
>     }
> }
> ==================================================
>
> Thank you very much!
>
> Lorenzo.
>
> --
>  
> Lorenzo Dini
>
> CERN ­ European Organization for Nuclear Research
> Information Technology Department
> CH-1211 Geneva 23  
>
> Building 31 - Office S-021
> Phone: +41 (0) 22 7672013
> Fax: +41 (0) 22 7668847
> E-mail: Lorenzo.Dini@cern.ch
>
>
>   

-- 

*Lorenzo Dini*

CERN -- European Organization for Nuclear Research
Information Technology Department
CH-1211 Geneva 23 

Building 31 - Office S-021
Phone: +41 (0) 22 7672013
Fax: +41 (0) 22 7668847
E-mail: Lorenzo.Dini@cern.ch