You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by ps...@wisnovsky.net on 2005/04/06 02:40:42 UTC

type mapping registry

I'd like to create a facade on top of an axis-generated web service proxy
that does some type substitutions with derived classes representing XML
schema elements; no new content but more convenience accessors, particularly
to help with <key> and <keyref> pointers and backpointers. Our web service
is evolving so I don't want to precompile a library with hardcoded mappings.
Can someone suggest a way to do this? I've tried accessing the type library
from an override of the service createCall method that tries to redefine a
type handler, but this doesn't seem to be having an effect. I've been trying
to run through with the debugger butI'm having trouble building the current
library, and the head revision doesn't match in these areas any more. I'll
try getting the 1.2b3 code but figuring out usage from the debugger is kind
of time consuming.

This is what I tried in my subclass of the service locator:

    public javax.xml.rpc.Call createCall()
        throws ServiceException
    {
        Call result = (org.apache.axis.client.Call) super.createCall();

        QName name = new
javax.xml.namespace.QName("http://yaddayadda.com/schemas/pvapi/PVTypes.xsd",
"commitment-type");

        TypeMappingRegistry registry = getTypeMappingRegistry();
        TypeMapping mapping = registry.createTypeMapping();
        SerializerFactory ser =  BaseSerializerFactory.createFactory(
            org.apache.axis.encoding.ser.BeanSerializerFactory.class,
            com.yaddayadda.api.client.types.CommitmentTypeExtended.class,
            name);
        DeserializerFactory deser = BaseDeserializerFactory.createFactory(
            org.apache.axis.encoding.ser.BeanDeserializerFactory.class,
            com.yaddayadda.api.client.types.CommitmentTypeExtended.class,
            name);

        mapping.register(
            com.yaddayadda.api.client.types.CommitmentTypeExtended.class,
            name,
            ser,
            deser);
        return result;
    }

I'm aware I probably don't want to register this on every call :-)

Thanks for any help one might be able to provide,

Peter