void DiscoverWebServiceMetadata(object sender, DoWorkEventArgs e) { Uri url = (Uri)e.Argument; var client = new DiscoveryClientProtocol(); client.Credentials = GetCredentials(); DiscoveryDocument document = client.DiscoverAny(url.AbsoluteUri); client.ResolveOneLevel(); e.Result = new ServiceReferenceDiscoveryEventArgs(client.References); }
public static ServiceDescriptionCollection GetServiceDescriptions(DiscoveryClientProtocol protocol) { ServiceDescriptionCollection services = new ServiceDescriptionCollection(); protocol.ResolveOneLevel(); foreach (DictionaryEntry entry in protocol.References) { ContractReference contractRef = entry.Value as ContractReference; if (contractRef != null) { services.Add(contractRef.Contract); } } return services; }