示例#1
0
        static void TestDownloadStream(string address, Binding binding)
        {
            ChannelFactory<IHelloWorld> channelFactory = new ChannelFactory<IHelloWorld>(binding, address);
            ServicePointManager.ServerCertificateValidationCallback = (snder, cert, chain, error) => true;
            channelFactory.Credentials.UserName.UserName = "******";
            channelFactory.Credentials.UserName.Password = "******";
            IHelloWorld client = channelFactory.CreateChannel();
            ((IChannel)client).Open();

            Console.WriteLine("Invoking DownloadStream...");
            Stream stream = client.DownloadStream();

            int readResult;
            int bytesRead = 0;
            byte[] buffer = new byte[1000];
            do
            {
                readResult = stream.Read(buffer, 0, buffer.Length);
                bytesRead += readResult;
            }
            while (readResult != 0);

            stream.Close();

            Console.WriteLine("Read {0} bytes.", bytesRead);

            ((IChannel)client).Close();
        }
        public ReverseWebProxy(Uri upstreamUri, Uri downstreamUri, TransportClientEndpointBehavior credentials)
        {
            this.upstreamUri = upstreamUri;
            this.downstreamUri = downstreamUri;

            this.upstreamBasePath = this.upstreamUri.PathAndQuery;
            if (this.upstreamBasePath.EndsWith("/"))
            {
                this.upstreamBasePath = this.upstreamBasePath.Substring(0, this.upstreamBasePath.Length - 1);
            }

            ServicePointManager.DefaultConnectionLimit = 50;

            WebHttpRelayBinding relayBinding = new WebHttpRelayBinding(EndToEndWebHttpSecurityMode.None, RelayClientAuthenticationType.None);
            relayBinding.MaxReceivedMessageSize = int.MaxValue;
            relayBinding.TransferMode = TransferMode.Streamed;
            relayBinding.AllowCookies = false;
            relayBinding.ReceiveTimeout = TimeSpan.MaxValue;
            relayBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;
            relayBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
            this.upstreamBinding = relayBinding;

            WebMessageEncodingBindingElement encoderBindingElement = new WebMessageEncodingBindingElement();
            encoderBindingElement.ReaderQuotas.MaxArrayLength = int.MaxValue;
            encoderBindingElement.ReaderQuotas.MaxStringContentLength = int.MaxValue;
            encoderBindingElement.ContentTypeMapper = new RawContentTypeMapper();
            encoder = encoderBindingElement.CreateMessageEncoderFactory().Encoder;

            this.credentials = credentials;
        }
 public static IGatewayServiceManagement CreateGatewayManagementChannel(Binding binding, Uri remoteUri, X509Certificate2 cert)
 {
     WebChannelFactory<IGatewayServiceManagement> factory = new WebChannelFactory<IGatewayServiceManagement>(binding, remoteUri);
     factory.Endpoint.Behaviors.Add(new ServiceManagementClientOutputMessageInspector());
     factory.Credentials.ClientCertificate.Certificate = cert;
     return factory.CreateChannel();
 }
		public InfocardInteractiveChannelInitializer (
			ClientCredentials credentials,
			Binding binding)
		{
			this.binding = binding;
			this.credentials = credentials;
		}
        //创建Wcf 服务端代理
        private static T createProxyInstance <T>(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress address)
        {
            Type objType = typeof(T);

            if (objType == null)
            {
                return(default(T));
            }
            object obj = null;

            try {
                object[] pars = new object[] { binding, address };
                obj = objType.Assembly.CreateInstance(objType.FullName, true, System.Reflection.BindingFlags.CreateInstance, null, pars, null, null);

                if (obj == null)
                {
                    throw new MB.Util.APPException(string.Format("根据类型:{0} 创建实例有误!", objType));
                }

                return((T)obj);
            }
            catch (Exception ex) {
                throw new MB.Util.APPException(string.Format("根据类型:{0}创建实例有误!", objType), APPMessageType.SysErrInfo, ex);
            }
        }
 internal static bool TryCreate(SecurityBindingElement sbe, TransportBindingElement transport, PrivacyNoticeBindingElement privacy, ReliableSessionBindingElement rsbe, TransactionFlowBindingElement tfbe, out Binding binding)
 {
     WSFederationHttpSecurityMode mode;
     WSFederationHttpSecurity security2;
     bool isReliableSession = rsbe != null;
     binding = null;
     HttpTransportSecurity transportSecurity = new HttpTransportSecurity();
     if (!WSFederationHttpBinding.GetSecurityModeFromTransport(transport, transportSecurity, out mode))
     {
         return false;
     }
     HttpsTransportBindingElement element = transport as HttpsTransportBindingElement;
     if (((element != null) && (element.MessageSecurityVersion != null)) && (element.MessageSecurityVersion.SecurityPolicyVersion != WS2007MessageSecurityVersion.SecurityPolicyVersion))
     {
         return false;
     }
     if (TryCreateSecurity(sbe, mode, transportSecurity, isReliableSession, out security2))
     {
         binding = new WS2007FederationHttpBinding(security2, privacy, isReliableSession);
     }
     if ((rsbe != null) && (rsbe.ReliableMessagingVersion != ReliableMessagingVersion.WSReliableMessaging11))
     {
         return false;
     }
     if ((tfbe != null) && (tfbe.TransactionProtocol != TransactionProtocol.WSAtomicTransaction11))
     {
         return false;
     }
     return (binding != null);
 }
示例#7
0
        /// <summary>
        /// Adds the given endpoint unless its already configured in app.config
        /// </summary>
        /// <param name="contractType"></param>
        /// <param name="binding"></param>
        /// <param name="address"></param>
        public void AddDefaultEndpoint(Type contractType,Binding binding,string address)
        {
            var serviceModel = ServiceModelSectionGroup.GetSectionGroup(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None));

            if(serviceModel == null)
             throw new InvalidOperationException("No service model section found in config");

            bool endpointAlreadyConfigured = false;

            foreach (ServiceElement se in serviceModel.Services.Services)
            {
                if (se.Name == Description.ConfigurationName)
                {
                    foreach (ServiceEndpointElement endpoint in se.Endpoints)
                    {
                        if (endpoint.Contract == contractType.FullName && endpoint.Address.OriginalString == address)
                            endpointAlreadyConfigured = true;
                    }

                }
            }
            if (!endpointAlreadyConfigured)
            {
                logger.Debug("Endpoint for contract: " + contractType.Name + " is not found in configuration, going to add it programatically");
                AddServiceEndpoint(contractType, binding, address);
            }
        }
示例#8
0
        internal MetadataSet GetMetadataInternal(EndpointAddress address, MetadataExchangeClientMode mode)
        {
            if (binding == null)
            {
                binding = MetadataExchangeBindings.CreateMexHttpBinding();
            }

            MetadataProxy proxy = new MetadataProxy(binding, address);

            proxy.Open();

            SMMessage msg = SMMessage.CreateMessage(
                MessageVersion.Soap12WSAddressing10,
                "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get");

            msg.Headers.ReplyTo = new EndpointAddress(
                "http://www.w3.org/2005/08/addressing/anonymous");
            //msg.Headers.From = new EndpointAddress ("http://localhost");
            msg.Headers.To        = address.Uri;
            msg.Headers.MessageId = new UniqueId();

            SMMessage ret;

            try {
                ret = proxy.Get(msg);
            } catch (Exception e) {
                throw new InvalidOperationException(
                          "Metadata contains a reference that cannot be resolved : " + address.Uri.AbsoluteUri, e);
            }

            return(MetadataSet.ReadFrom(ret.GetReaderAtBodyContents()));
        }
 internal GetTokenUIAsyncResult(Binding binding, IClientChannel channel, ClientCredentials credentials, AsyncCallback callback, object state) : base(callback, state)
 {
     this.credentials = credentials;
     this.proxy = channel;
     this.binding = binding;
     this.CallBegin(true);
 }
示例#10
0
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="binding">The binding.</param>
        /// <param name="endpointAddress">The endpoint address.</param>
        /// <param name="hostReconnectIntervalMilliseconds">The cache host reconnect interval, in milliseconds.</param>
        public CommunicationClient(Binding binding, EndpointAddress endpointAddress, int hostReconnectIntervalMilliseconds)
        {
            // Sanitize
            if (binding == null)
            {
                throw new ArgumentNullException("binding");
            }
            if (endpointAddress == null)
            {
                throw new ArgumentNullException("endpointAddress");
            }
            if (hostReconnectIntervalMilliseconds <= 0)
            {
                throw new ArgumentException("must be greater than 0", "hostReconnectIntervalMilliseconds");
            }

            // Initialize the channel factory with the binding and endpoint address
            _channelFactory = new ChannelFactory<IClientToCacheContract>(binding, endpointAddress);

            // Set the cache host reconnect interval
            _hostReconnectIntervalMilliseconds = hostReconnectIntervalMilliseconds;

            // Initialize WCF
            _proxy = _channelFactory.CreateChannel();
            _proxyComm = _proxy as ICommunicationObject;

            // Set connected before opening to avoid a race
            _isConnected = true;

            // Initialize and configure the reconnect timer to never fire
            _reconnectTimer = new Timer(ReconnectToServer, null, Timeout.Infinite, Timeout.Infinite);
        }
        /// <summary>
        /// Crea una nuova istanza della classe NeighborClient usando i parametri specificati per la configurazione
        /// del proxy interno e per l'allocazione della coda dedicata ai messaggi in uscita.
        /// </summary>
        /// <param name="bindingConfig">Le impostazioni di configurazione del proxy interno.</param>
        /// <param name="remoteUri">L'uri del servizio remoto con cui il proxy deve comunicare.</param>
        /// <param name="nodeId">L'identificatore univoco del nodo rappresentato da questa istanza dell'applicazione.</param>
        /// <param name="nodeId">L'identificatore univoco del nodo di destinazione dei messaggi inviati da questa applicazione.</param>
        /// <param name="outputQueueSize">Il massimo numero di messaggi che possono essere inseriti nella coda.</param>
        /// <exception cref="ArgumentNullException">bindingConfig e/o remoteUri e/o nodeId e/o targetNodeId sono sull.</exception>
        /// <exception cref="ArgumentOutOfRangeException">outputQueueSize è minore o uguale a zero.</exception>
        /// <remarks>
        /// La configurazione del proxy interno è posticipata e viene pertanto eseguita non appena verrà richiesta
        /// la prima comunicazione col servizio remoto.
        /// </remarks>
        public NeighborClient(Binding bindingConfig, Uri remoteUri, string nodeId, string targetNodeId, int outputQueueSize)
        {
            if (bindingConfig == null)
                throw new ArgumentNullException("bindingConfig");

            if (remoteUri == null)
                throw new ArgumentNullException("remoteUri");

            if (nodeId == null)
                throw new ArgumentNullException("nodeId");

            if (targetNodeId == null)
                throw new ArgumentNullException("targetNodeId");

            if (targetNodeId == nodeId)
                throw new ArgumentException("Target node identifier must be different from current node identifier.", "targetNodeId");

            if (outputQueueSize < 1)
                throw new ArgumentOutOfRangeException("outputQueueSize", "The size must be positive.");

            m_BindingConfig = bindingConfig;
            m_RemoteUri = remoteUri;

            m_NodeId = nodeId;
            m_TargetNodeId = targetNodeId;

            m_InternalProxy = null;
            m_ProxyClosed = false;

            m_OutputQueueSize = outputQueueSize;
            m_OutputQueue = new Queue<MessageData>(outputQueueSize);

            m_Shutdown = false;
            m_Dispatcher = new Thread(Send) { IsBackground = true };
        }
 protected override void OnApplyConfiguration(Binding binding)
 {
     base.OnApplyConfiguration(binding);
     BasicHttpBinding bpBinding = (BasicHttpBinding)binding;
     bpBinding.MessageEncoding = this.MessageEncoding;
     this.Security.ApplyConfiguration(bpBinding.Security);
 }
 protected internal override void InitializeFrom(Binding binding)
 {
     base.InitializeFrom(binding);
     MsmqIntegrationBinding binding2 = (MsmqIntegrationBinding) binding;
     this.SerializationFormat = binding2.SerializationFormat;
     this.Security.InitializeFrom(binding2.Security);
 }
示例#14
0
		public static void ConfigureQuotas(Binding binding, int quotaSize)
		{
			if (binding is BasicHttpBinding)
			{
				var basicHttpBinding = (BasicHttpBinding)binding;
				basicHttpBinding.MaxBufferSize = quotaSize;
				basicHttpBinding.MaxBufferPoolSize = quotaSize;
				basicHttpBinding.MaxReceivedMessageSize = quotaSize;
				ConfigureQuotas(basicHttpBinding.ReaderQuotas, quotaSize);
			}
			else if (binding is WSHttpBindingBase)
			{
				var wsHttpBinding = (WSHttpBindingBase)binding;
				wsHttpBinding.MaxBufferPoolSize = quotaSize;
				wsHttpBinding.MaxReceivedMessageSize = quotaSize;
				ConfigureQuotas(wsHttpBinding.ReaderQuotas, quotaSize);
			}
			else if (binding is WebHttpBinding)
			{
				var webHttpBinding = (WebHttpBinding)binding;
				webHttpBinding.MaxBufferSize = quotaSize;
				webHttpBinding.MaxBufferPoolSize = quotaSize;
				webHttpBinding.MaxReceivedMessageSize = quotaSize;
				ConfigureQuotas(webHttpBinding.ReaderQuotas, quotaSize);
			}
			else if (binding is NetTcpBinding)
			{
				var netTcpBinding = (NetTcpBinding)binding;
				netTcpBinding.MaxBufferSize = quotaSize;
				netTcpBinding.MaxBufferPoolSize = quotaSize;
				netTcpBinding.MaxReceivedMessageSize = quotaSize;
				ConfigureQuotas(netTcpBinding.ReaderQuotas, quotaSize);
			}
		}
示例#15
0
        public string GetBindingForBinding(Binding binding)
        {
            if (binding.Scheme.Equals("http", StringComparison.OrdinalIgnoreCase))
                return "Soap1_1";

            return "NetTcp";
        }
示例#16
0
        public string GetCredentialTypeForBinding(Binding binding)
        {
            if (binding.Scheme.Equals("http", StringComparison.OrdinalIgnoreCase))
                return "Username";

            return "Certificate";
        }
示例#17
0
 static void DescribeBinding(Binding binding)
 {
     foreach (BindingElement element in (new CustomBinding(binding)).Elements)
     {
         Console.WriteLine(element.GetType().Name);
     }
 }
 public static ISqlDatabaseManagement CreateSqlDatabaseManagementChannel(Binding binding, Uri remoteUri, X509Certificate2 cert, string requestSessionId)
 {
     WebChannelFactory<ISqlDatabaseManagement> factory = new WebChannelFactory<ISqlDatabaseManagement>(binding, remoteUri);
     factory.Endpoint.Behaviors.Add(new ClientOutputMessageInspector(requestSessionId));
     factory.Credentials.ClientCertificate.Certificate = cert;
     return factory.CreateChannel();
 }
		public IssuedSecurityTokenParameters (string tokenType,
			EndpointAddress issuerAddress, Binding issuerBinding)
		{
			token_type = tokenType;
			issuer_address = issuerAddress;
			binding = issuerBinding;
		}
 internal static bool TryCreate(BindingElementCollection bindingElements, out Binding binding)
 {
     if (bindingElements == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements");
     }
     binding = null;
     ContextBindingElement element = bindingElements.Find<ContextBindingElement>();
     if (element != null)
     {
         Binding binding2;
         BindingElementCollection elements = new BindingElementCollection(bindingElements);
         elements.Remove<ContextBindingElement>();
         if (WSHttpBindingBase.TryCreate(elements, out binding2))
         {
             bool allowCookies = ((WSHttpBinding) binding2).AllowCookies;
             if ((allowCookies && (element.ContextExchangeMechanism == ContextExchangeMechanism.HttpCookie)) || (!allowCookies && (element.ContextExchangeMechanism == ContextExchangeMechanism.ContextSoapHeader)))
             {
                 WSHttpContextBinding binding3 = new WSHttpContextBinding((WSHttpBinding) binding2) {
                     ContextProtectionLevel = element.ProtectionLevel,
                     ContextManagementEnabled = element.ContextManagementEnabled
                 };
                 binding = binding3;
             }
         }
     }
     return (binding != null);
 }
 protected override void OnApplyConfiguration(Binding binding)
 {
     base.OnApplyConfiguration(binding);
     MsmqIntegrationBinding miBinding = (MsmqIntegrationBinding) binding;
     miBinding.SerializationFormat = this.SerializationFormat;
     this.Security.ApplyConfiguration(miBinding.Security);
 }
示例#22
0
 static Message CreateReplyMessage(Binding binding)
 {
     string action = "http://www.artech.com/calculatorservice/AddResponse";
     XNamespace ns = "http://www.artech.com";
     XElement body = new XElement(new XElement(ns + "AddResponse", new XElement(ns + "AddResult", 3)));
     return Message.CreateMessage(binding.MessageVersion, action, body);
 }
示例#23
0
 //Used by live contacts channel and Solr search and RelatedItems
 public static CustomBinding GetCustomBinding(Binding source)
 {
     CustomBinding result = new CustomBinding(source);
     WebMessageEncodingBindingElement element = result.Elements.Find<WebMessageEncodingBindingElement>();
     element.ContentTypeMapper = new RawMapper();
     return result;
 }
 protected internal override void InitializeFrom(Binding binding)
 {
     base.InitializeFrom(binding);
     MsmqIntegrationBinding miBinding = (MsmqIntegrationBinding) binding;
     SetPropertyValueIfNotDefaultValue(ConfigurationStrings.SerializationFormat, miBinding.SerializationFormat);
     this.Security.InitializeFrom(miBinding.Security);
 }
示例#25
0
		public AnnouncementEndpoint (DiscoveryVersion discoveryVersion, Binding binding, EndpointAddress address)
			: base (null, binding, address)
		{
			if (discoveryVersion == null)
				throw new ArgumentNullException ("discoveryVersion");
			DiscoveryVersion = discoveryVersion;
		}
        internal void WriteBinding(Binding binding, out string bindingSectionName, out string configurationName)
        {
            BindingDictionaryValue result = CreateBindingConfig(binding);

            configurationName = result.BindingName;
            bindingSectionName = result.BindingSectionName;
        }
示例#27
0
        private WSRegistryServicePortTypeClient GetClient(String username, String password, 
            String serverURL, Binding binding)
        {
            ServicePointManager.ServerCertificateValidationCallback = 
                new RemoteCertificateValidationCallback(
                    delegate(object sender, X509Certificate certificate, 
                    X509Chain chain, SslPolicyErrors policyErrors) { return true; });
            AuthenticationAdminPortTypeClient authenticationAdmin =
                new AuthenticationAdminPortTypeClient(binding, 
                    new EndpointAddress(serverURL + "AuthenticationAdmin"));
            using (new OperationContextScope(authenticationAdmin.InnerChannel))
            {
                if (!authenticationAdmin.login(username, password, "127.0.0.1"))
                {
                    throw new SecurityException("Failed to login to system.");
                }
                HttpResponseMessageProperty response = (HttpResponseMessageProperty) 
                    System.ServiceModel.OperationContext.Current.
                    IncomingMessageProperties[HttpResponseMessageProperty.Name];
                cookie = response.Headers[HttpResponseHeader.SetCookie];
            }

            return new WSRegistryServicePortTypeClient(binding, 
                    new EndpointAddress(serverURL + "WSRegistryService"));
        }
 public IssuedTokenWSTrustBinding(Binding issuerBinding, EndpointAddress issuerAddress, SecurityMode mode, TrustVersion version, SecurityKeyType keyType, SecurityAlgorithmSuite algorithmSuite, string tokenType, IEnumerable<ClaimTypeRequirement> claimTypeRequirements, EndpointAddress issuerMetadataAddress)
     : base(mode, version)
 {
     this._claimTypeRequirements = new Collection<ClaimTypeRequirement>();
   
     if ((SecurityMode.Message != mode) && (SecurityMode.TransportWithMessageCredential != mode))
     {
         throw new InvalidOperationException("ID3226");
     }
     if ((this._keyType == SecurityKeyType.BearerKey) && (version == TrustVersion.WSTrustFeb2005))
     {
         throw new InvalidOperationException("ID3267");
     }
     
     this._keyType = keyType;
     this._algorithmSuite = algorithmSuite;
     this._tokenType = tokenType;
     this._issuerBinding = issuerBinding;
     this._issuerAddress = issuerAddress;
     this._issuerMetadataAddress = issuerMetadataAddress;
     
     if (claimTypeRequirements != null)
     {
         foreach (ClaimTypeRequirement requirement in claimTypeRequirements)
         {
             this._claimTypeRequirements.Add(requirement);
         }
     }
 }
示例#29
0
        private static async void SendMessages(Binding binding, int messageCount, string address)
        {

            var factory = binding.BuildChannelFactory<IDuplexSessionChannel>();
            try
            {
                factory.Open();
                var channel = factory.CreateChannel(new EndpointAddress(address));
                channel.Open();
                Console.WriteLine("Channel should be connected by now...");
                var sendBytes = Encoding.ASCII.GetBytes("Hello WCF over a channel");
                var message = Message.CreateMessage(binding.MessageVersion, "action", sendBytes);
                var clone = message.CreateBufferedCopy(int.MaxValue);

                for (int i = 0; i < messageCount; i++)
                {
                    await Task.Factory.FromAsync(channel.BeginSend(clone.CreateMessage(), null, null), channel.EndSend);
                }

                channel.Close();
            }
            finally
            {
                factory.Close();
            }
        }
 protected internal override void InitializeFrom(Binding binding)
 {
     base.InitializeFrom(binding);
     MsmqBindingBase base2 = (MsmqBindingBase) binding;
     this.DeadLetterQueue = base2.DeadLetterQueue;
     if (base2.CustomDeadLetterQueue != null)
     {
         this.CustomDeadLetterQueue = base2.CustomDeadLetterQueue;
     }
     this.Durable = base2.Durable;
     this.ExactlyOnce = base2.ExactlyOnce;
     this.MaxReceivedMessageSize = base2.MaxReceivedMessageSize;
     this.MaxRetryCycles = base2.MaxRetryCycles;
     if (!base2.ReceiveContextEnabled)
     {
         this.ReceiveContextEnabled = base2.ReceiveContextEnabled;
     }
     this.ReceiveErrorHandling = base2.ReceiveErrorHandling;
     this.ReceiveRetryCount = base2.ReceiveRetryCount;
     this.RetryCycleDelay = base2.RetryCycleDelay;
     this.TimeToLive = base2.TimeToLive;
     this.UseSourceJournal = base2.UseSourceJournal;
     this.UseMsmqTracing = base2.UseMsmqTracing;
     if (base2.ValidityDuration != MsmqDefaults.ValidityDuration)
     {
         this.ValidityDuration = base2.ValidityDuration;
     }
 }
示例#31
0
		public DiscoveryEndpoint (DiscoveryVersion discoveryVersion, ServiceDiscoveryMode discoveryMode, Binding binding, EndpointAddress endpointAddress)
			: base (null, binding, endpointAddress)
		{
			if (discoveryVersion == null)
				throw new ArgumentNullException ("discoveryVersion");
			DiscoveryVersion = discoveryVersion;
			DiscoveryMode = discoveryMode;
		}
 protected override void OnApplyConfiguration(Binding binding)
 {
     base.OnApplyConfiguration(binding);
     NetTcpContextBinding binding2 = (NetTcpContextBinding) binding;
     binding2.ClientCallbackAddress = this.ClientCallbackAddress;
     binding2.ContextManagementEnabled = this.ContextManagementEnabled;
     binding2.ContextProtectionLevel = this.ContextProtectionLevel;
 }
示例#33
0
        public override EventPortTypeClient CreateClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress address)
        {
            EndpointController controller = new EndpointController(new EndpointAddress(_serviceAddress));

            controller.WsaEnabled = true;
            Binding binding1 = new HttpBinding(new IChannelController[] { this, controller, _credentialsProvider });

            return(new EventPortTypeClient(binding1, address));
        }
 public PolicyElement(EndpointAddress target, EndpointAddress issuer, Collection <XmlElement> parameters, Uri privacyNoticeLink, int privacyNoticeVersion, bool isManagedIssuer, System.ServiceModel.Channels.Binding binding)
 {
     this.m_target              = target;
     this.m_issuer              = issuer;
     this.m_parameters          = parameters;
     this.m_policyNoticeLink    = privacyNoticeLink;
     this.m_policyNoticeVersion = privacyNoticeVersion;
     this.m_isManagedIssuer     = isManagedIssuer;
     this.m_binding             = binding;
 }
示例#35
0
 public ServiceEndpoint(ContractDescription contract, System.ServiceModel.Channels.Binding binding, EndpointAddress address)
 {
     if (contract == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("contract");
     }
     this.contract = contract;
     this.binding  = binding;
     this.address  = address;
 }
示例#36
0
 public static IEBSCommClient CreateClient(bool isVersion_13_0, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress)
 {
     if (isVersion_13_0)
     {
         return(new EBSCommClient_13_0(binding, remoteAddress));
     }
     else
     {
         return(new EBSCommClient_13_1(binding, remoteAddress));
     }
 }
示例#37
0
        public static MetadataSet GetMetadataSet(string url)
        {
            MetadataExchangeClientMode mode = MetadataExchangeClientMode.MetadataExchange;
            int maxReceivedMessageSize      = 3000000;
            Uri address = new Uri(url);

            System.ServiceModel.Channels.Binding mexBinding = null;
            if (string.Compare(address.Scheme, "http", StringComparison.OrdinalIgnoreCase) == 0)
            {
                mexBinding = MetadataExchangeBindings.CreateMexHttpBinding();
            }
            else if (string.Compare(address.Scheme, "https", StringComparison.OrdinalIgnoreCase) == 0)
            {
                mexBinding = MetadataExchangeBindings.CreateMexHttpsBinding();
            }
            else if (string.Compare(address.Scheme, "net.tcp", StringComparison.OrdinalIgnoreCase) == 0)
            {
                mexBinding = MetadataExchangeBindings.CreateMexTcpBinding();
            }
            else if (string.Compare(address.Scheme, "net.pipe", StringComparison.OrdinalIgnoreCase) == 0)
            {
                mexBinding = MetadataExchangeBindings.CreateMexNamedPipeBinding();
            }
            else
            {
                throw new Exception(string.Format("Not supported schema '{0}' for metadata exchange"));
            }

            if (mexBinding is WSHttpBinding)
            {
                (mexBinding as WSHttpBinding).MaxReceivedMessageSize = maxReceivedMessageSize;
                mode = MetadataExchangeClientMode.HttpGet;
            }
            else if (mexBinding is CustomBinding)
            {
                (mexBinding as CustomBinding).Elements.Find <TransportBindingElement>().MaxReceivedMessageSize = maxReceivedMessageSize;
            }
            else
            {
                throw new Exception(string.Format("Not supported binding for metadata exchange"));
            }

            MetadataExchangeClient proxy = new MetadataExchangeClient(mexBinding);

            proxy.ResolveMetadataReferences = true;
            MetadataSet mds = proxy.GetMetadata(address, mode);

            return(mds);
        }