Exemple #1
0
        /// <summary>
        /// Queries the proxy for a service
        /// </summary>
        /// <exception cref="NullReferenceException"></exception>
        /// <exception cref="System.Reflection.TargetInvocationException"></exception>
        /// <param name="serviceUri"></param>
        /// <returns></returns>
        public static EndpointDiscoveryMetadata Probe(Uri serviceUri)
        {
            var svcSearch = new ResolveCriteria(new EndpointAddress(serviceUri));

            ResolveResponse searchResponse;

            lock (ProbeClient)
            {
                searchResponse = ProbeClient.Resolve(svcSearch);
            }

            return(searchResponse.EndpointDiscoveryMetadata);
        }
Exemple #2
0
        /// <summary>
        /// Queries the proxy for a service
        /// </summary>
        /// <exception cref="NullReferenceException"></exception>
        /// <exception cref="System.Reflection.TargetInvocationException"></exception>
        /// <param name="serviceType"></param>
        /// <param name="serviceId"></param>
        /// <returns></returns>
        private static EndpointDiscoveryMetadata Probe(Type serviceType = null, string serviceId = null)
        {
            FindCriteria svcSearch = serviceType == null ? new FindCriteria() : new FindCriteria(serviceType);

            if (serviceId != null)
            {
                var searchExtension = new XElement("Id", serviceId);
                svcSearch.Extensions.Add(searchExtension);
            }

            FindResponse searchResponse;

            lock (ProbeClient)
            {
                searchResponse = ProbeClient.Find(svcSearch);
            }

            return(searchResponse.Endpoints.FirstOrDefault());
        }