On Wednesday 22 December 2004 22:46, Hewitt, Christopher wrote: > I would like to know if there is an easy way to have an axis client > serialize/deserialize user defined java classes, without having to > manually create type mappings or use wsdl2java?
Yes, that's entirely possible provided that your classes can be handled by the existing De/Serializers. Below are some utility methods I'm using in a base class for web services clients. Michael protected void registerCustomMapping( Class clazz, QName xmlType, Class serializerFactory, Class deserializerFactory ) { getTypeMapping().register( clazz, xmlType, BaseSerializerFactory.createFactory(serializerFactory, clazz, xmlType), BaseDeserializerFactory.createFactory(deserializerFactory, clazz, xmlType)); } protected void registerArrayMapping( Class clazz, QName xmlType ) { if (! clazz.isArray()) { throw new IllegalArgumentException( "clazz must be an array class"); } getTypeMapping().register( clazz, xmlType, BaseSerializerFactory.createFactory(ArraySerializerFactory.class, clazz, xmlType), BaseDeserializerFactory.createFactory(ArrayDeserializerFactory.class, clazz, xmlType)); } protected void registerBeanMapping( Class clazz, QName xmlType ) { getTypeMapping().register( clazz, xmlType, BaseSerializerFactory.createFactory(BeanSerializerFactory.class, clazz, xmlType), BaseDeserializerFactory.createFactory(BeanDeserializerFactory.class, clazz, xmlType)); } protected TypeMapping getTypeMapping() { return (TypeMapping)getService().getTypeMappingRegistry() .getTypeMapping(ENCODING); } protected Service getService() { return _service; } -- Michael Schuerig Not only does lightning not strike mailto:[EMAIL PROTECTED] twice, it usually doesn't strike once. http://www.schuerig.de/michael/ --Salman Rushdie, Fury