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: [EMAIL PROTECTED]
--
*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: [EMAIL PROTECTED]