Package org.apache.axis.encoding

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


                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 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

        // Get the type
        QName itemType = context.getTypeFromAttributes(namespace,
                                                       localName,
                                                       attributes);
        // Get the deserializer
        Deserializer dSer = null;
        if (itemType != null) {
           dSer = context.getDeserializerForType(itemType);
        }
        if (dSer == null) {
            dSer = new DeserializerImpl();
        }

        // When the value is deserialized, inform us.
        // Need to pass the index because multi-ref stuff may
        // result in the values being deserialized in a different order.
        dSer.registerValueTarget(new DeserializerTarget(this, new Integer(curIndex)));
        curIndex++;

        if (log.isDebugEnabled()) {
            log.debug("Exit: VectorDeserializer::onStartChild()");
        }
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) {
           
// FIXME : Currently this doesn't throw an error solely to enable the
//     "terra" testcase to pass.  We should, IMO, fix the test (either
//     to support <xsd:list> or to throw an error when we find such a thing
//     in the WSDL at WSDL2Java time).  Once that's done, this should be
//     uncommented and the next two lines deleted.           
//           
//            throw new SAXException(Messages.getMessage("noDeser00",
//                                                       childXMLType.toString()));

            dSer = new DeserializerImpl();
            return (SOAPHandler)dSer;
        }

        // 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)) {
                    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(null, bpd.getType(),
                                                    null, context);

                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();
                dSer.setDefaultType(defaultXMLType);
            }
        }
        if (javaType.equals(String.class) &&
            dSer instanceof SimpleDeserializer) {
            cacheStringDSer = (SimpleDeserializer) dSer;
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();
        SOAPConstants soapConstants = msgContext.getSOAPConstants();
        OperationDesc op = msgContext.getOperation();
        if (op != null) {
            FaultDesc faultDesc = op.getFaultByQName(qn);
            // allow fault type to be denoted in xsi:type
            if (faultDesc == null) {
                QName type = context.getTypeFromAttributes(namespace,
                                                           name,
                                                           attributes);
                if (type != null) {
                    faultDesc = op.getFaultByXmlType(type);
                }
            }
            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(soapConstants.getAttrHref()) == 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

        //  </method>
        // so that a list of 3 items is created.
        // Failure to register the target would result in the last
        // item not being added to the list
        if (context.isNil(attributes)) {
          Deserializer nilDSer =  new DeserializerImpl();
          nilDSer.registerValueTarget(
             new MethodTarget(currentParam,
                              RPCParam.getValueSetMethod()));
          return (SOAPHandler) nilDSer;
        }
       
        Deserializer dser = null;
        if ((type == null) && (namespace != null) && (!namespace.equals(""))) {
            dser = context.getDeserializerForType(qname);
        } else {
            dser = context.getDeserializer(destClass, type);
        }
       
        if (dser == null) {
          if (type != null) {
              dser = context.getDeserializerForType(type);
              if(null != destClass && dser == null && destClass.isAssignableFrom( org.w3c.dom.Element.class )){
                //If a DOM element is expected, as last resort always allow direct mapping
                // of parameter's SOAP xml to a DOM element.  Support of literal  parms by default.
                dser = context.getDeserializerForType(Constants.SOAP_ELEMENT);

              }
              if (dser == null) {
                  throw new SAXException(Messages.getMessage(
                          "noDeser01", localName,"" + type));
              }
              if (paramDesc != null && paramDesc.getJavaType() != null) {
                  // If we have an xsi:type, make sure it makes sense
                  // with the current paramDesc type
                  Class xsiClass =
                          context.getTypeMapping().getClassForQName(type);
                  if (null != xsiClass  && !JavaUtils.isConvertable(xsiClass, destClass)) {
                      throw new SAXException("Bad types (" +
                                             xsiClass + " -> " + destClass + ")"); // FIXME!
                  }
              }
          } else {
              dser = new DeserializerImpl();
              if (dser == null) {
                  throw new SAXException(Messages.getMessage(
                          "noDeser01", localName,"" + type));
              }
          }
        }

        dser.setDefaultType(type);

        dser.registerValueTarget(
             new MethodTarget(currentParam,
                 RPCParam.getValueSetMethod()));

        if (log.isDebugEnabled()) {
            log.debug("Exit: RPCHandler.onStartChild()");
View Full Code Here

        throws SAXException
    {

        QName thisQName = new QName(namespace, name);
        if (thisQName.equals(Constants.QNAME_FAULTVALUE_SOAP12)) {
            Deserializer currentDeser = null;
            currentDeser = context.getDeserializerForType(Constants.XSD_QNAME);
            if (currentDeser != null) {
                currentDeser.registerValueTarget(new CallbackTarget(this, thisQName));
            }
            return (SOAPHandler)currentDeser;
        } else if (thisQName.equals(Constants.QNAME_FAULTSUBCODE_SOAP12)) {
            return (next = new SOAPFaultCodeBuilder());
        } else
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

TOP

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

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.