コード例 #1
0
        protected virtual DiscoveryClient CreateClient(
            string endpointUrl,
            string endpointTransportProfileUri)
        {
            if (String.IsNullOrEmpty(endpointUrl))
            {
                endpointUrl = DefaultUrl;
            }

            if (!Uri.IsWellFormedUriString(endpointUrl, UriKind.Absolute))
            {
                throw new ArgumentException("Not a valid URL.", nameof(endpointUrl));
            }

            ServiceMessageContext context = ApplicationConfiguration.CreateMessageContext();

            EndpointConfiguration configuration = EndpointConfiguration.Create(ApplicationConfiguration);

            if (DefaultOperationTimeout != 0)
            {
                configuration.OperationTimeout = DefaultOperationTimeout;
            }

            ITransportChannel channel = DiscoveryChannel.Create(new Uri(endpointUrl), configuration, context);

            DiscoveryClient client = new DiscoveryClient(channel);

            return(client);
        }
コード例 #2
0
        public new static UaDiscoveryClient Create(Uri discoveryUrl)
        {
            var endpointConfiguration = EndpointConfiguration.Create();
            var channel = DiscoveryChannel.Create(discoveryUrl, endpointConfiguration, new ServiceMessageContext());

            return(new UaDiscoveryClient(channel));
        }
コード例 #3
0
        public new static UaDiscoveryClient Create(Uri discoveryUrl, EndpointConfiguration configuration)
        {
            if (configuration == null)
            {
                configuration = EndpointConfiguration.Create();
            }
            var channel = DiscoveryChannel.Create(discoveryUrl, configuration, new ServiceMessageContext());

            return(new UaDiscoveryClient(channel));
        }
コード例 #4
0
        public new static UaDiscoveryClient Create(Uri discoveryUrl, BindingFactory bindingFactory, EndpointConfiguration configuration)
        {
            if (discoveryUrl == null)
            {
                throw new ArgumentNullException("discoveryUrl");
            }
            if (bindingFactory == null)
            {
                bindingFactory = BindingFactory.Default;
            }
            if (configuration == null)
            {
                configuration = EndpointConfiguration.Create();
            }
            var channel = DiscoveryChannel.Create(discoveryUrl, bindingFactory, configuration, new ServiceMessageContext());

            return(new UaDiscoveryClient(channel));
        }