void ReflectBinding(ReflectedBinding reflectedBinding)
        {
            string bindingName      = XmlConvert.EncodeLocalName(reflectedBinding.bindingAttr.Name);
            string bindingNamespace = reflectedBinding.bindingAttr.Namespace;

            if (bindingName.Length == 0)
            {
                bindingName = Service.Name + ProtocolName;
            }
            if (bindingNamespace.Length == 0)
            {
                bindingNamespace = ServiceDescription.TargetNamespace;
            }
            WsiProfiles claims = WsiProfiles.None;

            if (reflectedBinding.bindingAttr.Location.Length > 0)
            {
                // If a URL is specified for the WSDL, file, then we just import the
                // binding from there instead of generating it in this WSDL file.
                portType = null;
                binding  = null;
            }
            else
            {
                bindingServiceDescription = GetServiceDescription(bindingNamespace);
                CodeIdentifiers bindingNames = new CodeIdentifiers();
                foreach (Binding b in bindingServiceDescription.Bindings)
                {
                    bindingNames.AddReserved(b.Name);
                }

                bindingName = bindingNames.AddUnique(bindingName, binding);

                portType      = new PortType();
                binding       = new Binding();
                portType.Name = bindingName;
                binding.Name  = bindingName;
                binding.Type  = new XmlQualifiedName(portType.Name, bindingNamespace);
                claims        = reflectedBinding.bindingAttr.ConformsTo & this.ConformsTo;
                if (reflectedBinding.bindingAttr.EmitConformanceClaims && claims != WsiProfiles.None)
                {
                    ServiceDescription.AddConformanceClaims(binding.GetDocumentationElement(), claims);
                }
                bindingServiceDescription.Bindings.Add(binding);
                bindingServiceDescription.PortTypes.Add(portType);
            }

            if (portNames == null)
            {
                portNames = new CodeIdentifiers();
                foreach (Port p in Service.Ports)
                {
                    portNames.AddReserved(p.Name);
                }
            }

            port         = new Port();
            port.Binding = new XmlQualifiedName(bindingName, bindingNamespace);
            port.Name    = portNames.AddUnique(bindingName, port);
            Service.Ports.Add(port);

            BeginClass();

            if (reflectedBinding.methodList != null && reflectedBinding.methodList.Count > 0)
            {
                foreach (LogicalMethodInfo method in reflectedBinding.methodList)
                {
                    MoveToMethod(method);

                    operation      = new Operation();
                    operation.Name = XmlConvert.EncodeLocalName(method.Name);
                    if (methodAttr.Description != null && methodAttr.Description.Length > 0)
                    {
                        operation.Documentation = methodAttr.Description;
                    }

                    operationBinding      = new OperationBinding();
                    operationBinding.Name = operation.Name;

                    inputMessage   = null;
                    outputMessage  = null;
                    headerMessages = null;

                    if (ReflectMethod())
                    {
                        if (inputMessage != null)
                        {
                            bindingServiceDescription.Messages.Add(inputMessage);
                        }
                        if (outputMessage != null)
                        {
                            bindingServiceDescription.Messages.Add(outputMessage);
                        }
                        if (headerMessages != null)
                        {
                            foreach (Message headerMessage in headerMessages)
                            {
                                bindingServiceDescription.Messages.Add(headerMessage);
                            }
                        }
                        binding.Operations.Add(operationBinding);
                        portType.Operations.Add(operation);
                    }
                }
            }
            if (binding != null && claims == WsiProfiles.BasicProfile1_1 && ProtocolName == "Soap")
            {
                BasicProfileViolationCollection warnings = new BasicProfileViolationCollection();
                WebServicesInteroperability.AnalyzeBinding(binding, bindingServiceDescription, ServiceDescriptions, warnings);
                if (warnings.Count > 0)
                {
                    throw new InvalidOperationException(Res.GetString(Res.WebWsiViolation, ServiceType.FullName, warnings.ToString()));
                }
            }
            EndClass();
        }
        private void ReflectBinding(ReflectedBinding reflectedBinding)
        {
            string identifier = XmlConvert.EncodeLocalName(reflectedBinding.bindingAttr.Name);
            string ns         = reflectedBinding.bindingAttr.Namespace;

            if (identifier.Length == 0)
            {
                identifier = this.Service.Name + this.ProtocolName;
            }
            if (ns.Length == 0)
            {
                ns = this.ServiceDescription.TargetNamespace;
            }
            WsiProfiles none = WsiProfiles.None;

            if (reflectedBinding.bindingAttr.Location.Length > 0)
            {
                this.portType = null;
                this.binding  = null;
            }
            else
            {
                this.bindingServiceDescription = this.GetServiceDescription(ns);
                CodeIdentifiers identifiers = new CodeIdentifiers();
                foreach (System.Web.Services.Description.Binding binding in this.bindingServiceDescription.Bindings)
                {
                    identifiers.AddReserved(binding.Name);
                }
                identifier         = identifiers.AddUnique(identifier, this.binding);
                this.portType      = new System.Web.Services.Description.PortType();
                this.binding       = new System.Web.Services.Description.Binding();
                this.portType.Name = identifier;
                this.binding.Name  = identifier;
                this.binding.Type  = new XmlQualifiedName(this.portType.Name, ns);
                none = reflectedBinding.bindingAttr.ConformsTo & this.ConformsTo;
                if (reflectedBinding.bindingAttr.EmitConformanceClaims && (none != WsiProfiles.None))
                {
                    System.Web.Services.Description.ServiceDescription.AddConformanceClaims(this.binding.GetDocumentationElement(), none);
                }
                this.bindingServiceDescription.Bindings.Add(this.binding);
                this.bindingServiceDescription.PortTypes.Add(this.portType);
            }
            if (this.portNames == null)
            {
                this.portNames = new CodeIdentifiers();
                foreach (System.Web.Services.Description.Port port in this.Service.Ports)
                {
                    this.portNames.AddReserved(port.Name);
                }
            }
            this.port         = new System.Web.Services.Description.Port();
            this.port.Binding = new XmlQualifiedName(identifier, ns);
            this.port.Name    = this.portNames.AddUnique(identifier, this.port);
            this.Service.Ports.Add(this.port);
            this.BeginClass();
            if ((reflectedBinding.methodList != null) && (reflectedBinding.methodList.Count > 0))
            {
                foreach (LogicalMethodInfo info in reflectedBinding.methodList)
                {
                    this.MoveToMethod(info);
                    this.operation      = new System.Web.Services.Description.Operation();
                    this.operation.Name = XmlConvert.EncodeLocalName(info.Name);
                    if ((this.methodAttr.Description != null) && (this.methodAttr.Description.Length > 0))
                    {
                        this.operation.Documentation = this.methodAttr.Description;
                    }
                    this.operationBinding      = new System.Web.Services.Description.OperationBinding();
                    this.operationBinding.Name = this.operation.Name;
                    this.inputMessage          = null;
                    this.outputMessage         = null;
                    this.headerMessages        = null;
                    if (this.ReflectMethod())
                    {
                        if (this.inputMessage != null)
                        {
                            this.bindingServiceDescription.Messages.Add(this.inputMessage);
                        }
                        if (this.outputMessage != null)
                        {
                            this.bindingServiceDescription.Messages.Add(this.outputMessage);
                        }
                        if (this.headerMessages != null)
                        {
                            foreach (Message message in this.headerMessages)
                            {
                                this.bindingServiceDescription.Messages.Add(message);
                            }
                        }
                        this.binding.Operations.Add(this.operationBinding);
                        this.portType.Operations.Add(this.operation);
                    }
                }
            }
            if (((this.binding != null) && (none == WsiProfiles.BasicProfile1_1)) && (this.ProtocolName == "Soap"))
            {
                BasicProfileViolationCollection violations = new BasicProfileViolationCollection();
                WebServicesInteroperability.AnalyzeBinding(this.binding, this.bindingServiceDescription, this.ServiceDescriptions, violations);
                if (violations.Count > 0)
                {
                    throw new InvalidOperationException(System.Web.Services.Res.GetString("WebWsiViolation", new object[] { this.ServiceType.FullName, violations.ToString() }));
                }
            }
            this.EndClass();
        }
        void ReflectBinding(ReflectedBinding reflectedBinding)
        {
            string bindingName      = reflectedBinding.bindingAttr.Name;
            string bindingNamespace = reflectedBinding.bindingAttr.Namespace;

            if (bindingName.Length == 0)
            {
                bindingName = Service.Name + ProtocolName;
            }
            if (bindingNamespace.Length == 0)
            {
                bindingNamespace = ServiceDescription.TargetNamespace;
            }

            if (reflectedBinding.bindingAttr.Location.Length > 0)
            {
                // If a URL is specified for the WSDL, file, then we just import the
                // binding from there instead of generating it in this WSDL file.
                portType = null;
                binding  = null;
            }
            else
            {
                bindingServiceDescription = GetServiceDescription(bindingNamespace);
                CodeIdentifiers bindingNames = new CodeIdentifiers();
                foreach (Binding b in bindingServiceDescription.Bindings)
                {
                    bindingNames.AddReserved(b.Name);
                }

                bindingName = bindingNames.AddUnique(bindingName, binding);

                portType      = new PortType();
                binding       = new Binding();
                portType.Name = bindingName;
                binding.Name  = bindingName;
                binding.Type  = new XmlQualifiedName(portType.Name, bindingNamespace);
                bindingServiceDescription.Bindings.Add(binding);
                bindingServiceDescription.PortTypes.Add(portType);
            }

            if (portNames == null)
            {
                portNames = new CodeIdentifiers();
                foreach (Port p in Service.Ports)
                {
                    portNames.AddReserved(p.Name);
                }
            }

            port         = new Port();
            port.Binding = new XmlQualifiedName(bindingName, bindingNamespace);
            port.Name    = portNames.AddUnique(bindingName, port);
            Service.Ports.Add(port);

            BeginClass();

            foreach (LogicalMethodInfo method in reflectedBinding.methodList)
            {
                MoveToMethod(method);

                operation               = new Operation();
                operation.Name          = method.Name;
                operation.Documentation = methodAttr.Description;

                operationBinding      = new OperationBinding();
                operationBinding.Name = operation.Name;

                inputMessage   = null;
                outputMessage  = null;
                headerMessages = null;

                if (ReflectMethod())
                {
                    if (inputMessage != null)
                    {
                        bindingServiceDescription.Messages.Add(inputMessage);
                    }
                    if (outputMessage != null)
                    {
                        bindingServiceDescription.Messages.Add(outputMessage);
                    }
                    if (headerMessages != null)
                    {
                        foreach (Message headerMessage in headerMessages)
                        {
                            bindingServiceDescription.Messages.Add(headerMessage);
                        }
                    }
                    binding.Operations.Add(operationBinding);
                    portType.Operations.Add(operation);
                }
            }

            EndClass();
        }