You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Rodrigo Ruiz <rr...@gridsystems.com> on 2003/09/04 17:17:27 UTC
Adding an interface to the TypeMappings
Hi all,
After some code diving in Axis 1.0, I managed to make Axis to use an
interface to serialize / deserialize objects of a given type.
Suppose I have the following code:
public interface MyIface1 {
... // public class methods
}
public interface MyIface2 {
... // public class methods
}
public class MyClass implements MyIface1, MyIface2 {
... // public methods defined in the interface MyIface1
... // public methods defined in the interface MyIface2
... // some private methods
}
To register MyIface1 and MyIface2, and instruct Axis to deserialize objects
of these types creating MyClass instances I had to register them the
following way:
void register(TypeMapping tm, Class clazz, Class iface) {
QName qname = new QName(...);
isf = new BeanSerializerFactory(iface, qname);
bdf = new BeanDeserializerFactory(clazz, qname);
tm.register( iface, qname, isf, null );
tm.register( clazz, qname, isf, bdf );
}
register(myTypeMapping, MyClass.class, MyIface1.class);
register(myTypeMapping, MyClass.class, MyIface2.class);
>From the code, you can see I am registering the class with a serializer and
deserializer that do not share their "javaType".
My questions are:
- Is there any equivalent way of declaring this mapping in a wsdd file?
- Is there any other simpler way to get the same results?
Thanks in advance!
--
GRIDSYSTEMS Rodrigo Ruiz Aguayo
Parc Bit - Son Espanyol Analista Programador
07120 Palma de Mallorca rruiz@gridsystems.com
Baleares - EspaƱa Tel:+34-971435085
www.gridsystems.com Fax:+34-971435082