コード例 #1
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection {
                this.txFlow,
                this.session
            };
            SecurityBindingElement item = this.CreateMessageSecurity();

            if (item != null)
            {
                elements.Add(item);
            }
            elements.Add(this.compositeDuplex);
            elements.Add(this.oneWay);
            WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.textEncoding, this.mtomEncoding);
            if (this.MessageEncoding == WSMessageEncoding.Text)
            {
                elements.Add(this.textEncoding);
            }
            else if (this.MessageEncoding == WSMessageEncoding.Mtom)
            {
                elements.Add(this.mtomEncoding);
            }
            elements.Add(this.httpTransport);
            return(elements.Clone());
        }
コード例 #2
0
        public override BindingElementCollection CreateBindingElements()
        {
            this.CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();

            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }
            // add encoding
            bindingElements.Add(_encoding);
            // add transport security
            BindingElement transportSecurity = CreateTransportSecurity();

            if (transportSecurity != null)
            {
                bindingElements.Add(transportSecurity);
            }

            // add transport (tcp)
            bindingElements.Add(_transport);

            return(bindingElements.Clone());
        }
コード例 #3
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // context

            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();

            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }

            // add encoding (text or mtom)
            WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(_textEncoding, _mtomEncoding);
            if (MessageEncoding == WSMessageEncoding.Text)
            {
                bindingElements.Add(_textEncoding);
            }
            else if (MessageEncoding == WSMessageEncoding.Mtom)
            {
                bindingElements.Add(_mtomEncoding);
            }

            // add transport (http or https)
            bindingElements.Add(GetTransport());

            return(bindingElements.Clone());
        }
コード例 #4
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection();
     elements.Add(this.encodingElement);
     elements.Add(this.transportElement);
     return elements.Clone();
 }
コード例 #5
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElementCollection = new BindingElementCollection();

            if (this.reliableSession.Enabled)
            {
                bindingElementCollection.Add(this.session);
            }
            SecurityBindingElement securityBindingElement = this.CreateMessageSecurity();

            if (securityBindingElement != null)
            {
                bindingElementCollection.Add(securityBindingElement);
            }
            Microsoft.ServiceBus.WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.textEncoding, this.mtomEncoding);
            if (this.MessageEncoding == WSMessageEncoding.Text)
            {
                bindingElementCollection.Add(this.textEncoding);
            }
            else if (this.MessageEncoding == WSMessageEncoding.Mtom)
            {
                bindingElementCollection.Add(this.mtomEncoding);
            }
            bindingElementCollection.Add(this.GetTransport());
            return(bindingElementCollection.Clone());
        }
コード例 #6
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(this.transport);
            return(bindingElements.Clone());
        }
コード例 #7
0
        public override BindingElementCollection CreateBindingElements()
        {
            this.CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add security (*optional)
            SecurityBindingElement wsSecurity = this.BasicHttpSecurity.CreateMessageSecurity();

            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }
            // add encoding (text or mtom)
            WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.TextMessageEncodingBindingElement, this.MtomMessageEncodingBindingElement);
            if (this.MessageEncoding == WSMessageEncoding.Text)
            {
                bindingElements.Add(this.TextMessageEncodingBindingElement);
            }
            else if (this.MessageEncoding == WSMessageEncoding.Mtom)
            {
                bindingElements.Add(this.MtomMessageEncodingBindingElement);
            }
            // add transport (http or https)
            bindingElements.Add(this.GetTransport());

            return(bindingElements.Clone());
        }
コード例 #8
0
ファイル: NetHttpsBinding.cs プロジェクト: liujf5566/wcf
        public override BindingElementCollection CreateBindingElements()
        {
            CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();

            // add security (*optional)
            SecurityBindingElement messageSecurity = BasicHttpSecurity.CreateMessageSecurity();

            if (messageSecurity != null)
            {
                bindingElements.Add(messageSecurity);
            }

            // add encoding
            switch (MessageEncoding)
            {
            case NetHttpMessageEncoding.Text:
                bindingElements.Add(TextMessageEncodingBindingElement);
                break;

            case NetHttpMessageEncoding.Mtom:
                throw ExceptionHelper.PlatformNotSupported(SR.Format(SR.UnsupportedBindingProperty, "MessageEncoding", MessageEncoding));

            default:
                bindingElements.Add(_binaryMessageEncodingBindingElement);
                break;
            }

            // add transport (http or https)
            bindingElements.Add(GetTransport());

            return(bindingElements.Clone());
        }
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection {
         this.txFlow
     };
     if (this.reliableSession.Enabled)
     {
         elements.Add(this.session);
     }
     SecurityBindingElement item = this.CreateMessageSecurity();
     if (item != null)
     {
         elements.Add(item);
     }
     WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.textEncoding, this.mtomEncoding);
     if (this.MessageEncoding == WSMessageEncoding.Text)
     {
         elements.Add(this.textEncoding);
     }
     else if (this.MessageEncoding == WSMessageEncoding.Mtom)
     {
         elements.Add(this.mtomEncoding);
     }
     elements.Add(this.GetTransport());
     return elements.Clone();
 }
コード例 #10
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            switch (this.Resolver.Mode)
            {
            case PeerResolverMode.Auto:
            {
                if (CanUseCustomResolver())
                {
                    bindingElements.Add(new PeerCustomResolverBindingElement(this.Resolver.Custom));
                }
                else if (PeerTransportDefaults.ResolverAvailable)
                {
                    bindingElements.Add(new PnrpPeerResolverBindingElement(this.Resolver.ReferralPolicy));
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.PeerResolverRequired)));
                }
            }
            break;

            case PeerResolverMode.Custom:
            {
                if (CanUseCustomResolver())
                {
                    bindingElements.Add(new PeerCustomResolverBindingElement(this.Resolver.Custom));
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.PeerResolverSettingsInvalid)));
                }
            }
            break;

            case PeerResolverMode.Pnrp:
            {
                if (PeerTransportDefaults.ResolverAvailable)
                {
                    bindingElements.Add(new PnrpPeerResolverBindingElement(this.Resolver.ReferralPolicy));
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.PeerResolverRequired)));
                }
            }
            break;

            default:
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.PeerResolverRequired)));
            }

            bindingElements.Add(encoding);
            bindingElements.Add(transport);
            transport.Security.Mode = this.Security.Mode;
            transport.Security.Transport.CredentialType = this.Security.Transport.CredentialType;

            return(bindingElements.Clone());
        }
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection {
         this.txFlow,
         this.session
     };
     SecurityBindingElement item = this.CreateMessageSecurity();
     if (item != null)
     {
         elements.Add(item);
     }
     elements.Add(this.compositeDuplex);
     elements.Add(this.oneWay);
     WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.textEncoding, this.mtomEncoding);
     if (this.MessageEncoding == WSMessageEncoding.Text)
     {
         elements.Add(this.textEncoding);
     }
     else if (this.MessageEncoding == WSMessageEncoding.Mtom)
     {
         elements.Add(this.mtomEncoding);
     }
     elements.Add(this.httpTransport);
     return elements.Clone();
 }
コード例 #12
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();

            // order of BindingElements is important
            // context

            // reliable
            if (_reliableSession.Enabled)
            {
                bindingElements.Add(_session);
            }

            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();

            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }

            // add encoding
            bindingElements.Add(_textEncoding);

            // add transport (http or https)
            bindingElements.Add(GetTransport());

            return(bindingElements.Clone());
        }
コード例 #13
0
        public override BindingElementCollection CreateBindingElements()
        {
            CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection
            {
                // order of BindingElements is important
                // add encoding
                _encoding
            };
            // add transport security
            BindingElement transportSecurity = CreateTransportSecurity();

            if (transportSecurity != null)
            {
                bindingElements.Add(transportSecurity);
            }
            // TODO: Add ExtendedProtectionPolicy
            _transport.ExtendedProtectionPolicy = _security.Transport.ExtendedProtectionPolicy;
            // add transport (tcp)
            bindingElements.Add(_transport);

            return(bindingElements.Clone());
        }
コード例 #14
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(binaryEncoding);

            if (this.securityMode == NetHttpSecurityMode.Transport)
            {
                bindingElements.Add(this.httpsTransport);
            }
            else
            {
                if (this.securityMode == NetHttpSecurityMode.TransportCredentialOnly)
                {
                    this.httpTransport.AuthenticationScheme = AuthenticationSchemes.Negotiate;
                }
                else
                {
                    this.httpTransport.AuthenticationScheme = AuthenticationSchemes.Anonymous;
                }
                bindingElements.Add(this.httpTransport);
            }

            return(bindingElements.Clone());
        }
コード例 #15
0
ファイル: NetTcpBinding.cs プロジェクト: sveinfid-prospa/wcf
        public override BindingElementCollection CreateBindingElements()
        {
            CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();

            // order of BindingElements is important
            // add session
            if (reliableSession.Enabled)
            {
                bindingElements.Add(session);
            }
            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();

            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }
            // add encoding
            bindingElements.Add(_encoding);
            // add transport security
            BindingElement transportSecurity = CreateTransportSecurity();

            if (transportSecurity != null)
            {
                bindingElements.Add(transportSecurity);
            }
            _transport.ExtendedProtectionPolicy = _security.Transport.ExtendedProtectionPolicy;
            // add transport (tcp)
            bindingElements.Add(_transport);

            return(bindingElements.Clone());
        }
コード例 #16
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection {
                this.txFlow
            };

            if (this.reliableSession.Enabled)
            {
                elements.Add(this.session);
            }
            SecurityBindingElement item = this.CreateMessageSecurity();

            if (item != null)
            {
                elements.Add(item);
            }
            WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(this.textEncoding, this.mtomEncoding);
            if (this.MessageEncoding == WSMessageEncoding.Text)
            {
                elements.Add(this.textEncoding);
            }
            else if (this.MessageEncoding == WSMessageEncoding.Mtom)
            {
                elements.Add(this.mtomEncoding);
            }
            elements.Add(this.GetTransport());
            return(elements.Clone());
        }
コード例 #17
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection {
                this.context
            };

            if (this.reliableSession.Enabled)
            {
                elements.Add(this.session);
            }
            SecurityBindingElement item = this.CreateMessageSecurity();

            if (item != null)
            {
                elements.Add(item);
            }
            elements.Add(this.encoding);
            BindingElement element2 = this.CreateTransportSecurity();

            if (element2 != null)
            {
                elements.Add(element2);
            }
            this.transport.ExtendedProtectionPolicy = this.security.Transport.ExtendedProtectionPolicy;
            elements.Add(this.transport);
            return(elements.Clone());
        }
コード例 #18
0
        /// <summary>
        /// Creates the binding elements.
        /// </summary>
        /// <returns></returns>
        public override BindingElementCollection CreateBindingElements()
        {
            var c = new BindingElementCollection();

            c.AddRange(base.CreateBindingElements());
            return(c.Clone());
        }
コード例 #19
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection bindingElementsCollection = new BindingElementCollection();
     bindingElementsCollection.Add(this.messageEncodingBindingElement);
     bindingElementsCollection.Add(this.transportBindingElement);
     return bindingElementsCollection.Clone();
 }
コード例 #20
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection        bindingElements = new BindingElementCollection();
            TransportSecurityBindingElement security        = SecurityBindingElement.CreateUserNameOverTransportBindingElement();

            security.IncludeTimestamp = false;
            bindingElements.Add(security);
            TextMessageEncodingBindingElement messageEncoding = new TextMessageEncodingBindingElement();

            messageEncoding.MessageVersion = MessageVersion.Soap11;
            bindingElements.Add(messageEncoding);
            HttpsTransportBindingElement transport = new HttpsTransportBindingElement();

            transport.MaxReceivedMessageSize             = int.MaxValue;
            transport.ManualAddressing                   = false;
            transport.AllowCookies                       = false;
            transport.AuthenticationScheme               = AuthenticationSchemes.Anonymous;
            transport.BypassProxyOnLocal                 = false;
            transport.DecompressionEnabled               = true;
            transport.HostNameComparisonMode             = HostNameComparisonMode.StrongWildcard;
            transport.KeepAliveEnabled                   = true;
            transport.ProxyAuthenticationScheme          = AuthenticationSchemes.Anonymous;
            transport.TransferMode                       = TransferMode.Buffered;
            transport.UnsafeConnectionNtlmAuthentication = false;
            transport.UseDefaultWebProxy                 = true;
            bindingElements.Add(transport);
            return(bindingElements.Clone());
        }
コード例 #21
0
ファイル: UaTcpBinding.cs プロジェクト: fr830/OPCUA.NET
        /// <summary>
        /// Create the set of binding elements that make up this binding.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.Collections.Generic.ICollection`1"/> object of type <see cref="T:System.ServiceModel.Channels.BindingElement"/> that contains the binding elements from the current binding object in the correct order.
        /// </returns>
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();

            elements.Add(m_transport);
            return(elements.Clone());
        }
コード例 #22
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();

            this.security.ConfigureTransportSecurity(base.transport);
            elements.Add(base.transport);
            return(elements.Clone());
        }
コード例 #23
0
ファイル: MyBinding.cs プロジェクト: Yuanxiangz/WorkSpace
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elemens = new BindingElementCollection();
     elemens.Add(new TextMessageEncodingBindingElement());
     elemens.Add(new MyBindingElement());
     elemens.Add(new HttpTransportBindingElement());
     return elemens.Clone();
 }
コード例 #24
0
        public override BindingElementCollection CreateBindingElements()
        {
            var bindingElements = new BindingElementCollection();

            bindingElements.Add(encoding);
            bindingElements.Add(transport);
            return(bindingElements.Clone());
        }
コード例 #25
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(this.xmlRpcTextEncoding);
            bindingElements.Add(this.GetTransport());
            return(bindingElements.Clone());
        }
コード例 #26
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(this.byteStreamEncoding);
            bindingElements.Add(this.httpTransport);
            return(bindingElements.Clone());
        }
コード例 #27
0
        /// <summary>
        /// COM port to be used on client side.
        /// </summary>
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();

            elements.Add(this.messageElement);
            elements.Add(this.transportElement);
            return(elements.Clone());
        }
コード例 #28
0
ファイル: UdpBinding.cs プロジェクト: Potapy4/dotnet-wcf
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(_textEncoding);
            bindingElements.Add(_udpTransport);

            return(bindingElements.Clone());
        }
コード例 #29
0
        /// <summary>
        /// Creates a clone of the existing BindingElement and returns it
        /// </summary>
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            //Only create once
            bindingElements.Add(this.BindingElement);
            //Return the clone
            return(bindingElements.Clone());
        }
コード例 #30
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elemens = new BindingElementCollection();

            elemens.Add(new TextMessageEncodingBindingElement());
            elemens.Add(new MyBindingElement());
            elemens.Add(new HttpTransportBindingElement());
            return(elemens.Clone());
        }
コード例 #31
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();

            elements.Add(_simpleBindingElement);
            elements.Add(_messageEncodingBindingElement);
            elements.Add(_transportBindingElement);
            return(elements.Clone());
        }
コード例 #32
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();
            if (security != null) elements.Add(security);
            elements.Add(messageEncoding);
            elements.Add(transport);

            return elements.Clone();
        }
コード例 #33
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();

            elements.Add(CreateSecurity());
            elements.Add(CreateMessageEncoding());
            elements.Add(CreateTransport());
            return(elements.Clone());
        }
コード例 #34
0
ファイル: HttpBinding.cs プロジェクト: reza899/aspnetwebstack
        /// <summary>
        /// Returns an ordered collection of binding elements contained in the current binding.
        /// (Overrides <see cref="System.ServiceModel.Channels.Binding.CreateBindingElements">
        /// Binding.CreateBindingElements</see>.)
        /// </summary>
        /// <returns>
        /// An ordered collection of binding elements contained in the current binding.
        /// </returns>
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(_httpMessageEncodingBindingElement);
            bindingElements.Add(GetTransport());

            return(bindingElements.Clone());
        }
コード例 #35
0
        /// <summary>
        /// Create the set of binding elements that make up this binding.
        /// NOTE: order of binding elements is important.
        /// </summary>
        /// <returns></returns>
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            // only two binding elements are used.
            bindingElements.Add(_encoding);
            bindingElements.Add(_transport);

            return(bindingElements.Clone());
        }
コード例 #36
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection();
     elements.Add(this._trafficControlBindingElement);
     elements.Add(this._messageEncodingBindingElement);
     //elements.Add(this._symmetricSecurityBindingElement);
     //elements.Add(this._transactionFlowBindingElement);
     elements.Add(this._transportBindingElement);
     return elements.Clone();
 }
コード例 #37
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElementCollection = base.CreateBindingElements();

            if (this.reliableSession.Enabled)
            {
                bindingElementCollection.Insert(0, this.session);
            }
            return(bindingElementCollection.Clone());
        }
コード例 #38
0
        public override BindingElementCollection CreateBindingElements()
        {

            BindingElementCollection bindingElements = new BindingElementCollection();
            
            bindingElements.Add(sessionElement);
            bindingElements.Add(encodingElement);
            bindingElements.Add(transportElement);
            
            return bindingElements.Clone();
        }
コード例 #39
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection();
     SecurityBindingElement item = this.CreateMessageSecurity();
     if (item != null)
     {
         elements.Add(item);
     }
     elements.Add(this.encoding);
     elements.Add(this.GetTransport());
     return elements.Clone();
 }
コード例 #40
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection();
     elements.Clear();
     if ((SecurityMode.Message == this._securityMode) || (SecurityMode.TransportWithMessageCredential == this._securityMode))
     {
         elements.Add(this.ApplyMessageSecurity(this.CreateSecurityBindingElement()));
     }
     elements.Add(this.CreateEncodingBindingElement());
     elements.Add(this.CreateTransportBindingElement());
     return elements.Clone();
 }
コード例 #41
0
 public override BindingElementCollection CreateBindingElements()
 {
     var elements = new BindingElementCollection();
     elements.Add(_messageElement);
     if (_sessionElement != null)
     {
         elements.Add(_sessionElement);
     }
     // the transport binding element must be the last one
     elements.Add(_transportElement);
     return elements.Clone();
 }
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection {
         this.context,
         this.encoding
     };
     WindowsStreamSecurityBindingElement item = this.CreateTransportSecurity();
     if (item != null)
     {
         elements.Add(item);
     }
     elements.Add(this.namedPipe);
     return elements.Clone();
 }
コード例 #43
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = base.CreateBindingElements();

            BindingElementCollection customElements = new BindingElementCollection();
            foreach (BindingElement element in elements)
            {
                BindingElement customElement = element;
                if (element is MessageEncodingBindingElement)
                {
                    MessageEncodingBindingElement encodingElement = (MessageEncodingBindingElement)element;

                    customElement = new CompressionMessageEncodingBindingElement(encodingElement);
                }

                customElements.Add(customElement);
            }

            return customElements.Clone();
        }
コード例 #44
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection elements = new BindingElementCollection {
         this.context
     };
     if (this.reliableSession.Enabled)
     {
         elements.Add(this.session);
     }
     SecurityBindingElement item = this.CreateMessageSecurity();
     if (item != null)
     {
         elements.Add(item);
     }
     elements.Add(this.encoding);
     BindingElement element2 = this.CreateTransportSecurity();
     if (element2 != null)
     {
         elements.Add(element2);
     }
     this.transport.ExtendedProtectionPolicy = this.security.Transport.ExtendedProtectionPolicy;
     elements.Add(this.transport);
     return elements.Clone();
 }
コード例 #45
0
 /// <summary>
 /// Creates a clone of the existing BindingElement and returns it
 /// </summary>
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection bindingElements = new BindingElementCollection();
     //Only create once
     bindingElements.Add(this.BindingElement);
     //Return the clone
     return bindingElements.Clone();
 }
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = new BindingElementCollection();
            switch (this.Resolver.Mode)
            {
                case PeerResolverMode.Auto:
                    if (!this.CanUseCustomResolver())
                    {
                        if (!PeerTransportDefaults.ResolverAvailable)
                        {
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("PeerResolverRequired")));
                        }
                        elements.Add(new PnrpPeerResolverBindingElement(this.Resolver.ReferralPolicy));
                        break;
                    }
                    elements.Add(new PeerCustomResolverBindingElement(this.Resolver.Custom));
                    break;

                case PeerResolverMode.Pnrp:
                    if (!PeerTransportDefaults.ResolverAvailable)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("PeerResolverRequired")));
                    }
                    elements.Add(new PnrpPeerResolverBindingElement(this.Resolver.ReferralPolicy));
                    break;

                case PeerResolverMode.Custom:
                    if (!this.CanUseCustomResolver())
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("PeerResolverSettingsInvalid")));
                    }
                    elements.Add(new PeerCustomResolverBindingElement(this.Resolver.Custom));
                    break;

                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("PeerResolverRequired")));
            }
            elements.Add(this.encoding);
            elements.Add(this.transport);
            this.transport.Security.Mode = this.Security.Mode;
            this.transport.Security.Transport.CredentialType = this.Security.Transport.CredentialType;
            return elements.Clone();
        }
コード例 #47
0
        public override BindingElementCollection CreateBindingElements()
        {
            this.CheckSettings();
            
            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add context
            bindingElements.Add(context);
            // add session
            if (reliableSession.Enabled)
                bindingElements.Add(session);
            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();
            if (wsSecurity != null)
                bindingElements.Add(wsSecurity);
            // add encoding
            bindingElements.Add(encoding);
            // add transport security
            BindingElement transportSecurity = CreateTransportSecurity();
            if (transportSecurity != null)
            {
                bindingElements.Add(transportSecurity);
            }
            transport.ExtendedProtectionPolicy = security.Transport.ExtendedProtectionPolicy;
            // add transport (tcp)
            bindingElements.Add(transport);

            return bindingElements.Clone();
        }
コード例 #48
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add security
            SecurityBindingElement wsSecurity = CreateMessageSecurity();
            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }
            // add encoding (text or mtom)
            bindingElements.Add(encoding);
            // add transport
            bindingElements.Add(GetTransport());

            return bindingElements.Clone();
        }
コード例 #49
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // context

            bindingElements.Add(txFlow);
            // reliable
            if (reliableSession.Enabled)
            {
                bindingElements.Add(session);
            }

            // add security (*optional)
            SecurityBindingElement wsSecurity = this.CreateMessageSecurity();
            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }

            // add encoding (text or mtom)
            WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(textEncoding, mtomEncoding);
            if (this.MessageEncoding == WSMessageEncoding.Text)
                bindingElements.Add(textEncoding);
            else if (this.MessageEncoding == WSMessageEncoding.Mtom)
                bindingElements.Add(mtomEncoding);

            // add transport (http or https)
            bindingElements.Add(GetTransport());

            return bindingElements.Clone();
        }
コード例 #50
0
        /// <summary>
        /// Create the set of binding elements that make up this binding. 
        /// NOTE: order of binding elements is important.
        /// </summary>
        /// <returns></returns>
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            if (ReliableSessionEnabled)
            {
                bindingElements.Add(session);
                bindingElements.Add(compositeDuplex);
            }

            bindingElements.Add(encoding);
            bindingElements.Add(transport);

            return bindingElements.Clone();
        }
コード例 #51
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add context
            bindingElements.Add(txFlow);
            // add session
            bindingElements.Add(session);
            // add security (optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();
            if (wsSecurity != null)
            {
                bindingElements.Add(wsSecurity);
            }

            // add duplex
            bindingElements.Add(compositeDuplex);

            // add oneWay adapter
            bindingElements.Add(oneWay);

            // add encoding (text or mtom)
            WSMessageEncodingHelper.SyncUpEncodingBindingElementProperties(textEncoding, mtomEncoding);
            if (this.MessageEncoding == WSMessageEncoding.Text)
            {
                bindingElements.Add(textEncoding);
            }
            else if (this.MessageEncoding == WSMessageEncoding.Mtom)
            {
                bindingElements.Add(mtomEncoding);
            }

            // add transport
            bindingElements.Add(httpTransport);

            return bindingElements.Clone();
        }
コード例 #52
0
 public override BindingElementCollection CreateBindingElements()
 {
     BindingElementCollection bindingElements = new BindingElementCollection();
     bindingElements.Add(SecurityBindingElement.CreateUserNameOverTransportBindingElement());
     MtomMessageEncodingBindingElement messageEncoding = new MtomMessageEncodingBindingElement();
     messageEncoding.MessageVersion = MessageVersion.Soap11;
     bindingElements.Add(messageEncoding);
     HttpsTransportBindingElement transport = new HttpsTransportBindingElement();
     transport.ManualAddressing = false;
     transport.AllowCookies = false;
     transport.AuthenticationScheme = AuthenticationSchemes.Anonymous;
     transport.BypassProxyOnLocal = false;
     transport.DecompressionEnabled = true;
     transport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
     transport.KeepAliveEnabled = true;
     transport.ProxyAuthenticationScheme = AuthenticationSchemes.Anonymous;
     transport.TransferMode = TransferMode.Buffered;
     transport.UnsafeConnectionNtlmAuthentication = false;
     transport.UseDefaultWebProxy = true;
     bindingElements.Add(transport);
     return bindingElements.Clone();
 }
コード例 #53
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add transport
            this.security.ConfigureTransportSecurity(transport);
            bindingElements.Add(transport);

            return bindingElements.Clone();
        }
コード例 #54
0
        /// <summary>
        /// Create the set of binding elements that make up this binding.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.Collections.Generic.ICollection`1"/> object of type <see cref="T:System.ServiceModel.Channels.BindingElement"/> that contains the binding elements from the current binding object in the correct order.
        /// </returns>
        public override BindingElementCollection CreateBindingElements()
        {   
            BindingElementCollection elements = new BindingElementCollection();

            if (m_security != null)
            {
                elements.Add(m_security);
            }

            elements.Add(m_encoding);
            elements.Add(m_transport);

            return elements.Clone();
        }
コード例 #55
0
ファイル: NetTcpBinding.cs プロジェクト: shijiaxing/wcf
        public override BindingElementCollection CreateBindingElements()
        {
            this.CheckSettings();

            // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add security (*optional)
            SecurityBindingElement wsSecurity = CreateMessageSecurity();
            if (wsSecurity != null)
                bindingElements.Add(wsSecurity);
            // add encoding
            bindingElements.Add(_encoding);
            // add transport security
            BindingElement transportSecurity = CreateTransportSecurity();
            if (transportSecurity != null)
            {
                bindingElements.Add(transportSecurity);
            }

            // add transport (tcp)
            bindingElements.Add(_transport);

            return bindingElements.Clone();
        }
コード例 #56
0
ファイル: NetHttpBinding.cs プロジェクト: spzenk/sfdocsamples
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            bindingElements.Add(binaryEncoding);

            if (this.securityMode == NetHttpSecurityMode.Transport)
            {
                bindingElements.Add(this.httpsTransport);
            }
            else
            {
                if (this.securityMode == NetHttpSecurityMode.TransportCredentialOnly)
                {
                    this.httpTransport.AuthenticationScheme = AuthenticationSchemes.Negotiate;
                }
                else
                {
                    this.httpTransport.AuthenticationScheme = AuthenticationSchemes.Anonymous;
                }
                bindingElements.Add(this.httpTransport);
            }

            return bindingElements.Clone();
        }
コード例 #57
0
 public override BindingElementCollection CreateBindingElements()
 { 
     BindingElementCollection bindingElements = new BindingElementCollection();
     bindingElements.Add(this.byteStreamEncoding);
     bindingElements.Add(this.httpTransport);
     return bindingElements.Clone();
 }
コード例 #58
0
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();
            switch (this.Resolver.Mode)
            {
                case PeerResolverMode.Auto:
                    {
                        if (CanUseCustomResolver())
                            bindingElements.Add(new PeerCustomResolverBindingElement(this.Resolver.Custom));
                        else if (PeerTransportDefaults.ResolverAvailable)
                            bindingElements.Add(new PnrpPeerResolverBindingElement(this.Resolver.ReferralPolicy));
                        else
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.PeerResolverRequired)));
                    }
                    break;
                case PeerResolverMode.Custom:
                    {
                        if (CanUseCustomResolver())
                            bindingElements.Add(new PeerCustomResolverBindingElement(this.Resolver.Custom));
                        else
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.PeerResolverSettingsInvalid)));
                    }
                    break;
                case PeerResolverMode.Pnrp:
                    {
                        if (PeerTransportDefaults.ResolverAvailable)
                            bindingElements.Add(new PnrpPeerResolverBindingElement(this.Resolver.ReferralPolicy));
                        else
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.PeerResolverRequired)));
                    }
                    break;
                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.PeerResolverRequired)));
            }

            bindingElements.Add(encoding);
            bindingElements.Add(transport);
            transport.Security.Mode = this.Security.Mode;
            transport.Security.Transport.CredentialType = this.Security.Transport.CredentialType;

            return bindingElements.Clone();
        }
コード例 #59
0
        /// <summary>
        /// Returns an ordered collection of binding elements contained in the current binding. 
        /// (Overrides <see cref="System.ServiceModel.Channels.Binding.CreateBindingElements">
        /// Binding.CreateBindingElements</see>.)
        /// </summary>
        /// <returns>
        /// An ordered collection of binding elements contained in the current binding.
        /// </returns>
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection bindingElements = new BindingElementCollection();

            bindingElements.Add(_httpMessageEncodingBindingElement);
            bindingElements.Add(GetTransport());

            return bindingElements.Clone();
        }
コード例 #60
0
        public override BindingElementCollection CreateBindingElements()
        {   // return collection of BindingElements
            BindingElementCollection bindingElements = new BindingElementCollection();
            // order of BindingElements is important
            // add context
            bindingElements.Add(context);
            // add encoding
            bindingElements.Add(encoding);
            // add transport security
            WindowsStreamSecurityBindingElement transportSecurity = CreateTransportSecurity();
            if (transportSecurity != null)
            {
                bindingElements.Add(transportSecurity);
            }
            // add transport (named pipes)
            bindingElements.Add(this.namedPipe);

            return bindingElements.Clone();
        }