public LookupServiceHelper(string lsUrl)
        {
            this.lsUrl = lsUrl;

            var binding = GetCustomBinding();
            var address = new EndpointAddress(lsUrl);

            lsPortType = new LsPortTypeClient(binding, address);

            var serviceInstanceRef = new ManagedObjectReference();

            serviceInstanceRef.type  = "LookupServiceInstance";
            serviceInstanceRef.Value = "ServiceInstance";
            serviceContent           = lsPortType.RetrieveServiceContent(
                serviceInstanceRef);
        }
        public LookupServiceClient(string hostname, X509CertificateValidator serverCertificateValidator)
        {
            var lsUri = $"https://{hostname}/lookupservice/sdk";

            _lsClient = new LsPortTypeClient(GetBinding(), new EndpointAddress(new Uri(lsUri)));

            var serverAuthentication = GetServerAuthentication(serverCertificateValidator);

            if (serverAuthentication != null)
            {
                _lsClient
                .ChannelFactory
                .Credentials
                .ServiceCertificate
                .SslCertificateAuthentication = serverAuthentication;
            }
        }
Пример #3
0
        public LookupServiceClient(string hostname, X509CertificateValidator serverCertificateValidator)
        {
            var lsUri = $"https://{hostname}/lookupservice/sdk";

            _lsClient = new LsPortTypeClient(GetBinding(), new EndpointAddress(new Uri(lsUri)));
            _lsClient.ChannelFactory.Endpoint.EndpointBehaviors.Add(new WsTrustBehavior());

            var serverAuthentication = GetServerAuthentication(serverCertificateValidator);

            if (serverAuthentication != null)
            {
                _lsClient
                .ChannelFactory
                .Credentials
                .ServiceCertificate
                .SslCertificateAuthentication = serverAuthentication;
            }

            // Create STS Client for authorized operations
            _stsClient = new STSClient(GetStsEndpointUri(), serverCertificateValidator);
        }