axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Reif" <ben.r...@ams.com>
Subject How to map Lists to extend ArraySerializer
Date Thu, 29 Apr 2004 14:18:51 GMT
I've got a web service that returns a List.  Sometimes it returns an
instance of ArrayList and somtimes it returns an instance of my own class
ClassifiedList, which extends ArrayList.  I've written my own
serializer/deserializer (and factories) to serialize ClassifiedList, but I
can't get Axis to call them when it tries to serialize an instance of
ClassifiedList. Axis internally maps all Lists and collections to
ArraySerializer and I need to override the default mapping.  I've tried
both of these mappings in the <service> tag of the WSDD file, but neither
seem to work.

<typeMapping
deserializer="com.ams.core.webservices.encoding.ser.ClassifiedListDeserializerFactory"
 languageSpecificType="
java:com.ams.core.util.ClassifiedList" qname="core21:ClassifiedList"
serializer="com.ams.core.webservices.encoding.ser.ClassifiedListSerializerFactory"
 xmlns:core21="
http://util.core.ams.com"/>

<typeMapping
deserializer="com.ams.core.webservices.encoding.ser.ClassifiedListDeserializerFactory"
 languageSpecificType="
java:com.ams.core.util.ClassifiedList" qname="soapenc:Array"
serializer="com.ams.core.webservices.encoding.ser.ClassifiedListSerializerFactory"
 xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/"/>

The only thing that I've got to work is to write a Handler that registers
it programatically:

      TypeMappingRegistry tmr = msgContext.getTypeMappingRegistry();
      TypeMapping tm = tmr.createTypeMapping();
      tm.register(ClassifiedList.class, Constants.SOAP_ARRAY,
                  new ClassifiedListSerializerFactory(), new
ClassifiedListDeserializerFactory());
      tmr.register(Constants.URI_SOAP11_ENC, tm);


This isn't really ideal to have to have a handler just to register 1
serializer/deserializer factory.  Does anyone know how I can do this with
XML in the WSDD file?

Thanks a lot,

Ben



Mime
View raw message