Esempio n. 1
0
        private System.ServiceModel.Channels.Binding CreateBindingForEndpoint(GatewayBindings binding)
        {
            if (binding == GatewayBindings.basicHttpsBinding)
            {
                System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding
                {
                    MaxBufferSize          = int.MaxValue,
                    ReaderQuotas           = System.Xml.XmlDictionaryReaderQuotas.Max,
                    MaxReceivedMessageSize = int.MaxValue,
                    AllowCookies           = true
                };
                return(result);
            }

            if (binding == GatewayBindings.wsHttpBinding)
            {
                System.ServiceModel.Channels.CustomBinding result = new System.ServiceModel.Channels.CustomBinding();
                System.ServiceModel.Channels.TextMessageEncodingBindingElement textBindingElement = new System.ServiceModel.Channels.TextMessageEncodingBindingElement();
                result.Elements.Add(textBindingElement);

                System.ServiceModel.Channels.HttpsTransportBindingElement httpsBindingElement = new System.ServiceModel.Channels.HttpsTransportBindingElement
                {
                    AllowCookies           = true,
                    MaxBufferSize          = int.MaxValue,
                    MaxReceivedMessageSize = int.MaxValue
                };
                result.Elements.Add(httpsBindingElement);

                return(result);
            }

            throw new InvalidOperationException(string.Format("Could not find endpoint configurations - \'{0}\'.", binding.ToString()));
        }
Esempio n. 2
0
        private System.ServiceModel.EndpointAddress CreateEndpointAddress(GatewayBindings binding)
        {
            if (binding == GatewayBindings.basicHttpsBinding)
            {
                return(new System.ServiceModel.EndpointAddress(serviceEndpoint));
            }

            if (binding == GatewayBindings.wsHttpBinding)
            {
                return(new System.ServiceModel.EndpointAddress(serviceEndpoint));
            }

            throw new InvalidOperationException(string.Format("Could not find endpoint configurations - \'{0}\'.", binding.ToString()));
        }