Package org.apache.axis.encoding

Examples of org.apache.axis.encoding.Deserializer$MethodTarget


                if (qn == null)
                    throw new SAXException(
                            Messages.getMessage("unregistered00", type.toString()));
               
                // get the deserializer
                Deserializer dSer = context.getDeserializerForType(qn);
                if (dSer == null)
                    throw new SAXException(
                            Messages.getMessage("noDeser00", type.toString()));
                if (! (dSer instanceof SimpleDeserializer))
                    throw new SAXException(
View Full Code Here


    public Object getValueAsType(QName type, Class cls) throws Exception
    {
        if (context == null)
            throw new Exception(Messages.getMessage("noContext00"));

        Deserializer dser = null;
        if (cls == null) {
            dser = context.getDeserializerForType(type);
        } else {
            dser = context.getDeserializerForClass(cls);
        }
        if (dser == null)
            throw new Exception(Messages.getMessage("noDeser00", "" + type));

        boolean oldVal = context.isDoneParsing();
        ((DeserializationContextImpl)context).deserializing(true);
        context.pushElementHandler(new EnvelopeHandler((SOAPHandler)dser));

        publishToHandler((org.xml.sax.ContentHandler) context);

        ((DeserializationContextImpl)context).deserializing(oldVal);

        return dser.getValue();
    }
View Full Code Here

    }

    public javax.xml.rpc.encoding.Deserializer
        getDeserializerAs(String mechanismType)
        throws JAXRPCException {
        Deserializer deser = null;

        // Need to add code to check against mechanisms vector.

        // Try getting a specialized Deserializer
        deser = getSpecialized(mechanismType);
View Full Code Here

                                    DeserializationContext context)
        throws SAXException
    {
        QName thisQName = new QName(namespace, name);
        if (thisQName.equals(Constants.QNAME_TEXT_SOAP12)) {
            Deserializer currentDeser = null;
            currentDeser = context.getDeserializerForType(Constants.XSD_STRING);
            if (currentDeser != null) {
                currentDeser.registerValueTarget(
                        new CallbackTarget(faultBuilder, thisQName));
            }
            return (SOAPHandler)currentDeser;
        } else {
            return null;
View Full Code Here

                if (qn == null)
                    throw new SAXException(
                            Messages.getMessage("unregistered00", type.toString()));

                // get the deserializer
                Deserializer dSer = context.getDeserializerForType(qn);
                if (dSer == null)
                    throw new SAXException(
                            Messages.getMessage("noDeser00", type.toString()));
                if (! (dSer instanceof SimpleListDeserializer))
                    throw new SAXException(
View Full Code Here

        if (childXMLType == null && fieldDesc != null && href == null) {
            childXMLType = fieldDesc.getXmlType();
        }
       
        // Get Deserializer for child, default to using DeserializerImpl
        Deserializer dSer = getDeserializer(childXMLType, propDesc.getType(),
                                            href,
                                            context);

        // It is an error if the dSer is not found - the only case where we
        // wouldn't have a deserializer at this point is when we're trying
        // to deserialize something we have no clue about (no good xsi:type,
        // no good metadata).
        if (dSer == null) {
            dSer = context.getDeserializerForClass(propDesc.getType());
        }
        if (dSer == null) {
            throw new SAXException(Messages.getMessage("noDeser00",
                                                       childXMLType.toString()));
        }

        // Register value target
        if (propDesc.isWriteable()) {
            // If this is an indexed property, and the deserializer we found
            // was NOT the ArrayDeserializer, this is a non-SOAP array:
            // <bean>
            //   <field>value1</field>
            //   <field>value2</field>
            // ...
            // In this case, we want to use the collectionIndex and make sure
            // the deserialized value for the child element goes into the
            // right place in the collection.
            if (propDesc.isIndexed() && (
                    !(dSer instanceof ArrayDeserializer) ||
                    propDesc.getType().isArray())) {
                    collectionIndex++;
                    dSer.registerValueTarget(new BeanPropertyTarget(value,
                                                    propDesc, collectionIndex));
            } else {
                // If we're here, the element maps to a single field value,
                // whether that be a "basic" type or an array, so use the
                // normal (non-indexed) BeanPropertyTarget form.
                collectionIndex = -1;
                dSer.registerValueTarget(new BeanPropertyTarget(value,
                                                                propDesc));
            }
        }
       
        // Let the framework know that we need this deserializer to complete
View Full Code Here

                    (BeanPropertyDescriptor) propertyMap.get(fieldName);
            if (bpd != null) {
                if (!bpd.isWriteable() || bpd.isIndexed() ) continue ;
               
                // Get the Deserializer for the attribute
                Deserializer dSer = getDeserializer(fieldDesc.getXmlType(),
                                                    bpd.getType(),
                                                    null,
                                                    context);
                if (dSer == null) {
                    dSer = context.getDeserializerForClass(bpd.getType());
                }
                if (dSer == null)
                    throw new SAXException(
                            Messages.getMessage("unregistered00",
                                                 bpd.getType().toString()));
               
                if (! (dSer instanceof SimpleDeserializer))
                    throw new SAXException(
                            Messages.getMessage("AttrNotSimpleType00",
                                                 bpd.getName(),
                                                 bpd.getType().toString()));
               
                // Success!  Create an object from the string and set
                // it in the bean
                try {
                    dSer.onStartElement(namespace, localName, prefix,
                                        attributes, context);
                    Object val = ((SimpleDeserializer)dSer).
                        makeValue(attributes.getValue(i));
                    bpd.set(value, val);
                } catch (Exception e) {
View Full Code Here

                cacheStringDSer.reset();
                return cacheStringDSer;
            }
        }
       
        Deserializer dSer = null;

        if (xmlType != null && href == null) {
            // Use the xmlType to get the deserializer.
            dSer = context.getDeserializerForType(xmlType);
        } else {
            // If the xmlType is not set, get a default xmlType
            TypeMapping tm = context.getTypeMapping();
            QName defaultXMLType = tm.getTypeQName(javaType);
            // If there is not href, then get the deserializer
            // using the javaType and default XMLType,
            // If there is an href, the create the generic
            // DeserializerImpl and set its default type (the
            // default type is used if the href'd element does
            // not have an xsi:type.
            if (href == null) {
                dSer = context.getDeserializer(javaType, defaultXMLType);
            } else {
                dSer = new DeserializerImpl();
                context.setDestinationClass(javaType);
                dSer.setDefaultType(defaultXMLType);
            }
        }
        if (javaType.equals(String.class) &&
            dSer instanceof SimpleDeserializer) {
            cacheStringDSer = (SimpleDeserializer) dSer;
View Full Code Here

    public Object getValueAsType(QName type) throws Exception
    {
        if (context == null)
            throw new Exception(Messages.getMessage("noContext00"));

        Deserializer dser = context.getDeserializerForType(type);
        if (dser == null)
            throw new Exception(Messages.getMessage("noDeser00", "" + type));

        boolean oldVal = context.isDoneParsing();
        ((DeserializationContextImpl)context).deserializing(true);
        context.pushElementHandler(new EnvelopeHandler((SOAPHandler)dser));

        publishToHandler((org.xml.sax.ContentHandler) context);

        ((DeserializationContextImpl)context).deserializing(oldVal);

        return dser.getValue();
    }
View Full Code Here

        // Look for <exceptionName> element and create a class
        // with that name - this is Axis specific and is
        // replaced by the Exception map
        if (name.equals("exceptionName")) {
            // Set up deser of exception name string
            Deserializer dser = context.getDeserializerForType(Constants.XSD_STRING);
            dser.registerValueTarget(new CallbackTarget(this, "exceptionName"));
            return (SOAPHandler)dser;
        }
                       
        // Look up this element in our faultMap
        // if we find a match, this element is the fault data
        MessageContext msgContext = context.getMessageContext();
        OperationDesc op = msgContext.getOperation();
        if (op != null) {
            FaultDesc faultDesc = op.getFaultByQName(qn);
            if (faultDesc != null) {
                // Set the class
                try {
                    Class faultClass = ClassUtils.forName(faultDesc.getClassName());
                    builder.setFaultClass(faultClass);
                } catch (ClassNotFoundException e) {
                    // Just create an AxisFault, no custom exception
                }
                builder.setWaiting(true);
                // register callback for the data, use the xmlType from fault info
                Deserializer dser = null;
                if (attributes.getValue("href") == null) {
                    dser = context.getDeserializerForType(faultDesc.getXmlType());
                } else {
                    dser = new DeserializerImpl();
                    dser.setDefaultType(faultDesc.getXmlType());
                }
                if (dser != null) {
                    dser.registerValueTarget(new CallbackTarget(this, "faultData"));
                }
                return (SOAPHandler)dser;
            }
        }
       
View Full Code Here

TOP

Related Classes of org.apache.axis.encoding.Deserializer$MethodTarget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.