SoapToString() static private method

static private SoapToString ( Object data, InternalPrimitiveTypeE code ) : String
data Object
code InternalPrimitiveTypeE
return String
Example #1
0
        internal void WriteItem(NameInfo itemNameInfo, NameInfo typeNameInfo, object value)
        {
            this.attrList.Clear();
            if (itemNameInfo.NItransmitTypeOnMember)
            {
                this.attrList.Put("xsi:type", this.TypeNameTagResolver(typeNameInfo, true));
            }
            string str = null;

            if (typeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.QName)
            {
                if (value != null)
                {
                    SoapQName name = (SoapQName)value;
                    if ((name.Key == null) || (name.Key.Length == 0))
                    {
                        this.attrList.Put("xmlns", "");
                    }
                    else
                    {
                        this.attrList.Put("xmlns:" + name.Key, name.Namespace);
                    }
                    str = name.ToString();
                }
            }
            else
            {
                str = Converter.SoapToString(value, typeNameInfo.NIprimitiveTypeEnum);
            }
            this.NamespaceAttribute();
            this.Write(InternalElementTypeE.Member, "item", this.attrList, str, false, typeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.Invalid);
        }
Example #2
0
        internal void WriteAttributeValue(NameInfo memberNameInfo, NameInfo typeNameInfo, object value)
        {
            string str = null;

            if (value is string)
            {
                str = (string)value;
            }
            else
            {
                str = Converter.SoapToString(value, typeNameInfo.NIprimitiveTypeEnum);
            }
            this.attrValueList.Put(this.MemberElementName(memberNameInfo, typeNameInfo), str);
        }
Example #3
0
        internal void WriteMember(NameInfo memberNameInfo, NameInfo typeNameInfo, object value)
        {
            this.attrList.Clear();
            if ((typeNameInfo.NItype != null) && (memberNameInfo.NItransmitTypeOnMember || (memberNameInfo.NItransmitTypeOnObject && !memberNameInfo.NIisArrayItem)))
            {
                this.attrList.Put("xsi:type", this.TypeNameTagResolver(typeNameInfo, true));
            }
            string str = null;

            if (value != null)
            {
                if (typeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.QName)
                {
                    SoapQName name = (SoapQName)value;
                    if ((name.Key == null) || (name.Key.Length == 0))
                    {
                        this.attrList.Put("xmlns", "");
                    }
                    else
                    {
                        this.attrList.Put("xmlns:" + name.Key, name.Namespace);
                    }
                    str = name.ToString();
                }
                else if (value is string)
                {
                    str = (string)value;
                }
                else
                {
                    str = Converter.SoapToString(value, typeNameInfo.NIprimitiveTypeEnum);
                }
            }
            NameInfo info = null;

            if (typeNameInfo.NInameSpaceEnum == InternalNameSpaceE.Interop)
            {
                info = typeNameInfo;
            }
            string str2 = this.MemberElementName(memberNameInfo, info);

            this.NamespaceAttribute();
            this.Write(InternalElementTypeE.Member, str2, this.attrList, str, true, Converter.IsEscaped(typeNameInfo.NIprimitiveTypeEnum));
        }
Example #4
0
        internal void WriteHeaderEntry(NameInfo nameInfo, NameInfo typeNameInfo, object value)
        {
            this.attrList.Clear();
            if (value == null)
            {
                this.attrList.Put("xsi:null", "1");
            }
            else
            {
                this.attrList.Put("xsi:type", this.TypeNameTagResolver(typeNameInfo, true));
            }
            if (nameInfo.NIisMustUnderstand)
            {
                this.attrList.Put("SOAP-ENV:mustUnderstand", "1");
                this.isUsedEnc = true;
            }
            this.attrList.Put("xmlns:" + nameInfo.NIheaderPrefix, nameInfo.NInamespace);
            this.attrList.Put("SOAP-ENC:root", "1");
            string str = null;

            if (value != null)
            {
                if ((typeNameInfo != null) && (typeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.QName))
                {
                    SoapQName name = (SoapQName)value;
                    if ((name.Key == null) || (name.Key.Length == 0))
                    {
                        this.attrList.Put("xmlns", "");
                    }
                    else
                    {
                        this.attrList.Put("xmlns:" + name.Key, name.Namespace);
                    }
                    str = name.ToString();
                }
                else
                {
                    str = Converter.SoapToString(value, typeNameInfo.NIprimitiveTypeEnum);
                }
            }
            this.NamespaceAttribute();
            this.Write(InternalElementTypeE.Member, nameInfo.NIheaderPrefix + ":" + nameInfo.NIname, this.attrList, str, true, true);
        }
Example #5
0
        internal void WriteTopPrimitive(NameInfo nameInfo, object value)
        {
            this.attrList.Clear();
            this.Write(InternalElementTypeE.ObjectBegin, "SOAP-ENV:Body", this.attrList, null, false, false);
            if (nameInfo.NIobjectId > 0L)
            {
                this.attrList.Put("id", this.IdToString((int)nameInfo.NIobjectId));
            }
            string str = null;

            if (value is string)
            {
                str = (string)value;
            }
            else
            {
                str = Converter.SoapToString(value, nameInfo.NIprimitiveTypeEnum);
            }
            this.Write(InternalElementTypeE.Member, "xsd:" + Converter.ToXmlDataType(nameInfo.NIprimitiveTypeEnum), this.attrList, str, true, false);
        }