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 Jianliang Zhao <jz...@zaplet.com> on 2002/10/03 22:47:16 UTC

auto types in TypeMappingImpl

Hi All,

I was using the auto typing feature in RC1, and it was working fine. After I upgraded Axis to RC2, the WSDL generation works fine with automatic type mapping for java types without explicit type mapping, but at the serialization time, I got the error saying no serializer found for the auto typing java classes. I have to add some lines( in red) into TypeMappingImpl.getSerializer to make it work and did the same thing to getDeserializer. Would someone fix this problem? Will this feature be exposed through the WSDD config file?

    public javax.xml.rpc.encoding.SerializerFactory
        getSerializer(Class javaType, QName xmlType)
        throws JAXRPCException {

        javax.xml.rpc.encoding.SerializerFactory sf = null;

        // If the xmlType was not provided, get one
        if (xmlType == null) {
            xmlType = getTypeQName(javaType);
            // If we couldn't find one, we're hosed, since getTypeQName()
            // already asked all of our delegates.
            if (xmlType == null) {
                return null;
            }

            // If we're doing autoTyping, and we got a type in the right
            // namespace, we can use the default serializer.
            if (doAutoTypes &&
                    xmlType.getNamespaceURI().equals(Constants.NS_URI_JAVA)) {
                return new BeanSerializerFactory(javaType, xmlType);
            }
        }

        // Try to get the serializer associated with this pair
        Pair pair = new Pair(javaType, xmlType);

        // Now get the serializer with the pair
        sf = (javax.xml.rpc.encoding.SerializerFactory) pair2SF.get(pair);

        // If not successful, use the javaType to get another Pair unless
        // we've got an array, in which case make sure we get the
        // ArraySerializer.
        if (sf == null) {
            if (javaType.isArray()) {
                pair = (Pair) qName2Pair.get(Constants.SOAP_ARRAY);
            } else {
                pair = (Pair) class2Pair.get(pair.javaType);
            }
            if (pair != null) {
                sf = (javax.xml.rpc.encoding.SerializerFactory) pair2SF.get(pair);
            }
        }

        if (sf == null && delegate != null) {
            sf = (SerializerFactory)
                delegate.getSerializer(javaType, xmlType);
        }

        if (sf == null && doAutoTypes &&
                xmlType.getNamespaceURI().equals(Constants.NS_URI_JAVA)) {
            return new BeanSerializerFactory(javaType, xmlType);
        }

        return sf;
    }

Thanks,

Jianliang