axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rodrigo Ruiz" <rr...@gridsystems.com>
Subject Adding an interface to the TypeMappings
Date Thu, 04 Sep 2003 15:17:27 GMT
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


Mime
View raw message