Exemplo n.º 1
0
        /**
         * Response from the soap call. Pulls the object from the wrapper object and returns it.
         *
         * @return response from the soap call.
         * @throws SoapFault
         * @since 2.0.3
         */

        public Object getResponse()
        {
            if (bodyIn == null)
            {
                return(null);
            }
            if (bodyIn is SoapFault)
            {
                throw (SoapFault)bodyIn;
            }
            FvmSerializable ks = (FvmSerializable)bodyIn;

            if (ks.getPropertyCount() == 0)
            {
                return(null);
            }
            else if (ks.getPropertyCount() == 1)
            {
                return(ks.getProperty(0));
            }
            else
            {
                List <object> ret = new List <object>();
                for (int i = 0; i < ks.getPropertyCount(); i++)
                {
                    ret.Add(ks.getProperty(i));
                }
                return(ret);
            }
        }
Exemplo n.º 2
0
        protected void writeArrayListBody(XmlSerializer writer, List <object> list)
        {
            FvmSerializable obj          = (FvmSerializable)list;
            int             cnt          = list.Count;
            PropertyInfo    propertyInfo = new PropertyInfo();
            String          namespace_;
            String          name;
            String          type;

            for (int i = 0; i < cnt; i++)
            {
                // get the property
                Object prop = obj.getProperty(i);
                // and importantly also get the property info which holds the name potentially!
                obj.getPropertyInfo(i, properties, propertyInfo);

                if (!(prop is SoapObject))
                {
                    // prop is a PropertyInfo
                    if ((propertyInfo.flags & PropertyInfo.TRANSIENT) == 0)
                    {
                        Object objValue = obj.getProperty(i);
                        if ((prop != null || !skipNullProperties) && (objValue != SoapPrimitive.NullSkip))
                        {
                            writer.startTag(propertyInfo.namespace_, propertyInfo.name);
                            writeProperty(writer, objValue, propertyInfo);
                            writer.endTag(propertyInfo.namespace_, propertyInfo.name);
                        }
                    }
                }
                else
                {
                    // prop is a SoapObject
                    SoapObject nestedSoap = (SoapObject)prop;
                    // lets get the info from the soap object itself
                    Object[] qName = getInfo(null, nestedSoap);
                    namespace_ = (String)qName[QNAME_NAMESPACE];
                    type       = (String)qName[QNAME_TYPE];

                    // prefer the name from the property info
                    if (propertyInfo.name != null && propertyInfo.name.Length > 0)
                    {
                        name = propertyInfo.name;
                    }
                    else
                    {
                        name = (String)qName[QNAME_TYPE];
                    }

                    // prefer the namespace_ from the property info
                    if (propertyInfo.namespace_ != null && propertyInfo.namespace_.Length > 0)
                    {
                        namespace_ = propertyInfo.namespace_;
                    }
                    else
                    {
                        namespace_ = (String)qName[QNAME_NAMESPACE];
                    }

                    writer.startTag(namespace_, name);
                    if (!implicitTypes)
                    {
                        String prefix = writer.getPrefix(namespace_, true);
                        writer.attribute(xsi, TYPE_LABEL, prefix + ":" + type);
                    }
                    writeObjectBodyWithAttributes(writer, nestedSoap);
                    writer.endTag(namespace_, name);
                }
            }
            if (obj is HasInnerText)
            {
                if (((HasInnerText)obj).getInnerText() != null)
                {
                    writer.cdsect(((HasInnerText)obj).getInnerText());
                }
            }
        }