Пример #1
0
        public LookupServiceRegistrationInfo[] ListRegisteredServices()
        {
            // Retrieve Service Content
            var svcContent     = _lsClient.RetrieveServiceContentAsync(RootMoRef).Result;
            var filterCriteria = new LookupServiceRegistrationFilter();

            filterCriteria.searchAllSsoDomains = true;
            var result = _lsClient.ListAsync(svcContent.serviceRegistration, filterCriteria);

            return(result.Result.returnval);
        }
        private Uri FindServiceEndpoint(string product, string type, string endpointType)
        {
            Uri result = null;

            var svcContent     = _lsClient.RetrieveServiceContentAsync(RootMoRef).Result;
            var filterCriteria = new LookupServiceRegistrationFilter()
            {
                serviceType = new LookupServiceRegistrationServiceType {
                    product = product,
                    type    = type
                }
            };

            var lsRegInfo = _lsClient.
                            ListAsync(svcContent.serviceRegistration, filterCriteria)
                            .Result?
                            .returnval?
                            .FirstOrDefault();

            if (lsRegInfo != null)
            {
                var registrationEndpooint = lsRegInfo.
                                            serviceEndpoints?.
                                            Where(a => a.endpointType.type == endpointType)?.
                                            FirstOrDefault <LookupServiceRegistrationEndpoint>();
                if (registrationEndpooint != null)
                {
                    result = new Uri(registrationEndpooint.url);
                }
            }
            return(result);
        }