axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lorenzo Dini <Lorenzo.D...@cern.ch>
Subject Problem on inheritance
Date Tue, 20 Mar 2007 20:46:04 GMT
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


Mime
View raw message