SoapFormatExtensions.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Web / System / Web / Services / Description / SoapFormatExtensions.cs / 1305376 / SoapFormatExtensions.cs

                            namespace System.Web.Services.Description { 
    using System.Xml;
    using System.IO;
    using System.Xml.Schema;
    using System.Xml.Serialization; 
    using System.ComponentModel;
    using System.Text; 
    using System.Web.Services.Configuration; 

    ///  
    [XmlFormatExtension("binding", SoapBinding.Namespace, typeof(Binding))]
    [XmlFormatExtensionPrefix("soap", SoapBinding.Namespace)]
    [XmlFormatExtensionPrefix("soapenc", "http://schemas.xmlsoap.org/soap/encoding/")]
    public class SoapBinding : ServiceDescriptionFormatExtension { 
        SoapBindingStyle style = SoapBindingStyle.Document;
        string transport; 
        static XmlSchema schema = null; 

        ///  
        public const string Namespace="http://schemas.xmlsoap.org/wsdl/soap/";
        /// 
        public const string HttpTransport = "http://schemas.xmlsoap.org/soap/http";
 
        /// 
        [XmlAttribute("transport")] 
        public string Transport { 
            get { return transport == null ? string.Empty : transport; }
            set { transport = value; } 
        }

        /// 
        [XmlAttribute("style"), DefaultValue(SoapBindingStyle.Document)] 
        public SoapBindingStyle Style {
            get { return style; } 
            set { style =  value; } 
        }
 
        /// 
        /// 
        ///    [To be supplied.]
        ///  
        public static XmlSchema Schema {
            get { 
                if (schema == null) { 
                    schema = XmlSchema.Read(new StringReader(Schemas.Soap), null);
                } 
                return schema;
            }
        }
    } 

    ///  
    public enum SoapBindingStyle { 
        /// 
        [XmlIgnore] 
        Default,
        /// 
        [XmlEnum("document")]
        Document, 
        /// 
        [XmlEnum("rpc")] 
        Rpc, 
    }
 
    /// 
    [XmlFormatExtension("operation", SoapBinding.Namespace, typeof(OperationBinding))]
    public class SoapOperationBinding : ServiceDescriptionFormatExtension {
        string soapAction; 
        SoapBindingStyle style;
 
        ///  
        [XmlAttribute("soapAction")]
        public string SoapAction { 
            get { return soapAction == null ? string.Empty : soapAction; }
            set { soapAction =  value; }
        }
 
        /// 
        [XmlAttribute("style"), DefaultValue(SoapBindingStyle.Default)] 
        public SoapBindingStyle Style { 
            get { return style; }
            set { style =  value; } 
        }
    }

    ///  
    [XmlFormatExtension("body", SoapBinding.Namespace, typeof(InputBinding), typeof(OutputBinding), typeof(MimePart))]
    public class SoapBodyBinding : ServiceDescriptionFormatExtension { 
        SoapBindingUse use; 
        string ns;
        string encoding; 
        string[] parts;

        /// 
        [XmlAttribute("use"), DefaultValue(SoapBindingUse.Default)] 
        public SoapBindingUse Use {
            get { return use; } 
            set { use =  value; } 
        }
 
        /// 
        [XmlAttribute("namespace"), DefaultValue("")]
        public string Namespace {
            get { return ns == null ? string.Empty : ns; } 
            set { ns =  value; }
        } 
 
        /// 
        [XmlAttribute("encodingStyle"), DefaultValue("")] 
        public string Encoding {
            get { return encoding == null ? string.Empty : encoding; }
            set { encoding =  value; }
        } 

        ///  
        [XmlAttribute("parts")] 
        public string PartsString {
            get { 
                if (parts == null)
                    return null;
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < parts.Length; i++) { 
                    if (i > 0) builder.Append(' ');
                    builder.Append(parts[i]); 
                } 
                return builder.ToString();
            } 
            set {
                if (value == null)
                    parts = null;
                else 
                    parts = value.Split(new char[] {' '});
            } 
        } 

        ///  
        [XmlIgnore]
        public string[] Parts {
            get { return parts; }
            set { parts = value; } 
        }
    } 
 
    /// 
    public enum SoapBindingUse { 
        /// 
        [XmlIgnore]
        Default,
        ///  
        [XmlEnum("encoded")]
        Encoded, 
        ///  
        [XmlEnum("literal")]
        Literal, 
    }

    /// 
    [XmlFormatExtension("fault", SoapBinding.Namespace, typeof(FaultBinding))] 
    public class SoapFaultBinding : ServiceDescriptionFormatExtension {
        SoapBindingUse use; 
        string ns; 
        string encoding;
        string name; 

        /// 
        [XmlAttribute("use"), DefaultValue(SoapBindingUse.Default)]
        public SoapBindingUse Use { 
            get { return use; }
            set { use =  value; } 
        } 

        ///  
        [XmlAttribute("name")]
        public string Name {
            get { return name; }
            set { name =  value; } 
        }
        ///  
        [XmlAttribute("namespace")] 
        public string Namespace {
            get { return ns == null ? string.Empty : ns; } 
            set { ns =  value; }
        }

        ///  
        [XmlAttribute("encodingStyle"), DefaultValue("")]
        public string Encoding { 
            get { return encoding == null ? string.Empty : encoding; } 
            set { encoding =  value; }
        } 
    }

    /// 
    [XmlFormatExtension("header", SoapBinding.Namespace, typeof(InputBinding), typeof(OutputBinding))] 
    public class SoapHeaderBinding : ServiceDescriptionFormatExtension {
        XmlQualifiedName message = XmlQualifiedName.Empty; 
        string part; 
        SoapBindingUse use;
        string encoding; 
        string ns;
        bool mapToProperty;
        SoapHeaderFaultBinding fault;
 
        /// 
        [XmlIgnore] 
        public bool MapToProperty { 
            get { return mapToProperty; }
            set { mapToProperty = value; } 
        }

        /// 
        [XmlAttribute("message")] 
        public XmlQualifiedName Message {
            get { return message; } 
            set { message = value; } 
        }
 
        /// 
        [XmlAttribute("part")]
        public string Part {
            get { return part; } 
            set { part = value; }
        } 
 
        /// 
        [XmlAttribute("use"), DefaultValue(SoapBindingUse.Default)] 
        public SoapBindingUse Use {
            get { return use; }
            set { use =  value; }
        } 

        ///  
        [XmlAttribute("encodingStyle"), DefaultValue("")] 
        public string Encoding {
            get { return encoding == null ? string.Empty : encoding; } 
            set { encoding =  value; }
        }

        ///  
        [XmlAttribute("namespace"), DefaultValue("")]
        public string Namespace { 
            get { return ns == null ? string.Empty : ns; } 
            set { ns =  value; }
        } 

        /// 
        [XmlElement("headerfault")]
        public SoapHeaderFaultBinding Fault { 
            get { return fault; }
            set { fault = value; } 
        } 
    }
 
    /// 
    public class SoapHeaderFaultBinding : ServiceDescriptionFormatExtension {
        XmlQualifiedName message = XmlQualifiedName.Empty;
        string part; 
        SoapBindingUse use;
        string encoding; 
        string ns; 

       ///  
        [XmlAttribute("message")]
        public XmlQualifiedName Message {
            get { return message; }
            set { message = value; } 
        }
 
       ///  
        [XmlAttribute("part")]
        public string Part { 
            get { return part; }
            set { part = value; }
        }
 
        /// 
        [XmlAttribute("use"), DefaultValue(SoapBindingUse.Default)] 
        public SoapBindingUse Use { 
            get { return use; }
            set { use =  value; } 
        }

        /// 
        [XmlAttribute("encodingStyle"), DefaultValue("")] 
        public string Encoding {
            get { return encoding == null ? string.Empty : encoding; } 
            set { encoding =  value; } 
        }
 
        /// 
        [XmlAttribute("namespace"), DefaultValue("")]
        public string Namespace {
            get { return ns == null ? string.Empty : ns; } 
            set { ns =  value; }
        } 
    } 

    ///  
    [XmlFormatExtension("address", SoapBinding.Namespace, typeof(Port))]
    public class SoapAddressBinding : ServiceDescriptionFormatExtension {
        string location;
 
        /// 
        [XmlAttribute("location")] 
        public string Location { 
            get { return location == null ? string.Empty : location; }
            set { location =  value; } 
        }
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace System.Web.Services.Description { 
    using System.Xml;
    using System.IO;
    using System.Xml.Schema;
    using System.Xml.Serialization; 
    using System.ComponentModel;
    using System.Text; 
    using System.Web.Services.Configuration; 

    ///  
    [XmlFormatExtension("binding", SoapBinding.Namespace, typeof(Binding))]
    [XmlFormatExtensionPrefix("soap", SoapBinding.Namespace)]
    [XmlFormatExtensionPrefix("soapenc", "http://schemas.xmlsoap.org/soap/encoding/")]
    public class SoapBinding : ServiceDescriptionFormatExtension { 
        SoapBindingStyle style = SoapBindingStyle.Document;
        string transport; 
        static XmlSchema schema = null; 

        ///  
        public const string Namespace="http://schemas.xmlsoap.org/wsdl/soap/";
        /// 
        public const string HttpTransport = "http://schemas.xmlsoap.org/soap/http";
 
        /// 
        [XmlAttribute("transport")] 
        public string Transport { 
            get { return transport == null ? string.Empty : transport; }
            set { transport = value; } 
        }

        /// 
        [XmlAttribute("style"), DefaultValue(SoapBindingStyle.Document)] 
        public SoapBindingStyle Style {
            get { return style; } 
            set { style =  value; } 
        }
 
        /// 
        /// 
        ///    [To be supplied.]
        ///  
        public static XmlSchema Schema {
            get { 
                if (schema == null) { 
                    schema = XmlSchema.Read(new StringReader(Schemas.Soap), null);
                } 
                return schema;
            }
        }
    } 

    ///  
    public enum SoapBindingStyle { 
        /// 
        [XmlIgnore] 
        Default,
        /// 
        [XmlEnum("document")]
        Document, 
        /// 
        [XmlEnum("rpc")] 
        Rpc, 
    }
 
    /// 
    [XmlFormatExtension("operation", SoapBinding.Namespace, typeof(OperationBinding))]
    public class SoapOperationBinding : ServiceDescriptionFormatExtension {
        string soapAction; 
        SoapBindingStyle style;
 
        ///  
        [XmlAttribute("soapAction")]
        public string SoapAction { 
            get { return soapAction == null ? string.Empty : soapAction; }
            set { soapAction =  value; }
        }
 
        /// 
        [XmlAttribute("style"), DefaultValue(SoapBindingStyle.Default)] 
        public SoapBindingStyle Style { 
            get { return style; }
            set { style =  value; } 
        }
    }

    ///  
    [XmlFormatExtension("body", SoapBinding.Namespace, typeof(InputBinding), typeof(OutputBinding), typeof(MimePart))]
    public class SoapBodyBinding : ServiceDescriptionFormatExtension { 
        SoapBindingUse use; 
        string ns;
        string encoding; 
        string[] parts;

        /// 
        [XmlAttribute("use"), DefaultValue(SoapBindingUse.Default)] 
        public SoapBindingUse Use {
            get { return use; } 
            set { use =  value; } 
        }
 
        /// 
        [XmlAttribute("namespace"), DefaultValue("")]
        public string Namespace {
            get { return ns == null ? string.Empty : ns; } 
            set { ns =  value; }
        } 
 
        /// 
        [XmlAttribute("encodingStyle"), DefaultValue("")] 
        public string Encoding {
            get { return encoding == null ? string.Empty : encoding; }
            set { encoding =  value; }
        } 

        ///  
        [XmlAttribute("parts")] 
        public string PartsString {
            get { 
                if (parts == null)
                    return null;
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < parts.Length; i++) { 
                    if (i > 0) builder.Append(' ');
                    builder.Append(parts[i]); 
                } 
                return builder.ToString();
            } 
            set {
                if (value == null)
                    parts = null;
                else 
                    parts = value.Split(new char[] {' '});
            } 
        } 

        ///  
        [XmlIgnore]
        public string[] Parts {
            get { return parts; }
            set { parts = value; } 
        }
    } 
 
    /// 
    public enum SoapBindingUse { 
        /// 
        [XmlIgnore]
        Default,
        ///  
        [XmlEnum("encoded")]
        Encoded, 
        ///  
        [XmlEnum("literal")]
        Literal, 
    }

    /// 
    [XmlFormatExtension("fault", SoapBinding.Namespace, typeof(FaultBinding))] 
    public class SoapFaultBinding : ServiceDescriptionFormatExtension {
        SoapBindingUse use; 
        string ns; 
        string encoding;
        string name; 

        /// 
        [XmlAttribute("use"), DefaultValue(SoapBindingUse.Default)]
        public SoapBindingUse Use { 
            get { return use; }
            set { use =  value; } 
        } 

        ///  
        [XmlAttribute("name")]
        public string Name {
            get { return name; }
            set { name =  value; } 
        }
        ///  
        [XmlAttribute("namespace")] 
        public string Namespace {
            get { return ns == null ? string.Empty : ns; } 
            set { ns =  value; }
        }

        ///  
        [XmlAttribute("encodingStyle"), DefaultValue("")]
        public string Encoding { 
            get { return encoding == null ? string.Empty : encoding; } 
            set { encoding =  value; }
        } 
    }

    /// 
    [XmlFormatExtension("header", SoapBinding.Namespace, typeof(InputBinding), typeof(OutputBinding))] 
    public class SoapHeaderBinding : ServiceDescriptionFormatExtension {
        XmlQualifiedName message = XmlQualifiedName.Empty; 
        string part; 
        SoapBindingUse use;
        string encoding; 
        string ns;
        bool mapToProperty;
        SoapHeaderFaultBinding fault;
 
        /// 
        [XmlIgnore] 
        public bool MapToProperty { 
            get { return mapToProperty; }
            set { mapToProperty = value; } 
        }

        /// 
        [XmlAttribute("message")] 
        public XmlQualifiedName Message {
            get { return message; } 
            set { message = value; } 
        }
 
        /// 
        [XmlAttribute("part")]
        public string Part {
            get { return part; } 
            set { part = value; }
        } 
 
        /// 
        [XmlAttribute("use"), DefaultValue(SoapBindingUse.Default)] 
        public SoapBindingUse Use {
            get { return use; }
            set { use =  value; }
        } 

        ///  
        [XmlAttribute("encodingStyle"), DefaultValue("")] 
        public string Encoding {
            get { return encoding == null ? string.Empty : encoding; } 
            set { encoding =  value; }
        }

        ///  
        [XmlAttribute("namespace"), DefaultValue("")]
        public string Namespace { 
            get { return ns == null ? string.Empty : ns; } 
            set { ns =  value; }
        } 

        /// 
        [XmlElement("headerfault")]
        public SoapHeaderFaultBinding Fault { 
            get { return fault; }
            set { fault = value; } 
        } 
    }
 
    /// 
    public class SoapHeaderFaultBinding : ServiceDescriptionFormatExtension {
        XmlQualifiedName message = XmlQualifiedName.Empty;
        string part; 
        SoapBindingUse use;
        string encoding; 
        string ns; 

       ///  
        [XmlAttribute("message")]
        public XmlQualifiedName Message {
            get { return message; }
            set { message = value; } 
        }
 
       ///  
        [XmlAttribute("part")]
        public string Part { 
            get { return part; }
            set { part = value; }
        }
 
        /// 
        [XmlAttribute("use"), DefaultValue(SoapBindingUse.Default)] 
        public SoapBindingUse Use { 
            get { return use; }
            set { use =  value; } 
        }

        /// 
        [XmlAttribute("encodingStyle"), DefaultValue("")] 
        public string Encoding {
            get { return encoding == null ? string.Empty : encoding; } 
            set { encoding =  value; } 
        }
 
        /// 
        [XmlAttribute("namespace"), DefaultValue("")]
        public string Namespace {
            get { return ns == null ? string.Empty : ns; } 
            set { ns =  value; }
        } 
    } 

    ///  
    [XmlFormatExtension("address", SoapBinding.Namespace, typeof(Port))]
    public class SoapAddressBinding : ServiceDescriptionFormatExtension {
        string location;
 
        /// 
        [XmlAttribute("location")] 
        public string Location { 
            get { return location == null ? string.Empty : location; }
            set { location =  value; } 
        }
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK