private static ServiceEndpointCollection ResolveContracts( IEnumerable <ContractDescription> contracts, Func <MetadataSet> metadataGetter) { if (contracts == null) { throw new ArgumentNullException("contracts"); } List <ContractDescription> list = new List <ContractDescription> (contracts); if (list.Count == 0) { throw new ArgumentException("There must be atleast one ContractDescription", "contracts"); } MetadataSet metadata = metadataGetter(); WsdlImporter importer = new WsdlImporter(metadata); ServiceEndpointCollection endpoints = importer.ImportAllEndpoints(); ServiceEndpointCollection ret = new ServiceEndpointCollection(); foreach (ContractDescription contract in list) { Collection <ServiceEndpoint> colln = endpoints.FindAll(new QName(contract.Name, contract.Namespace)); for (int i = 0; i < colln.Count; i++) { ret.Add(colln [i]); } } return(ret); }
public ServiceEndpointCollection ImportEndpoints(Service service) { var coll = new ServiceEndpointCollection(); foreach (Port port in service.Ports) { var sep = ImportEndpoint(port, false); if (sep != null) { coll.Add(sep); } } return(coll); }
void ImportEndpoints(ServiceEndpointCollection coll, WSBinding binding) { foreach (WSServiceDescription wsd in wsdl_documents) { foreach (WS.Service service in wsd.Services) { foreach (WS.Port port in service.Ports) { if (!binding.Name.Equals(port.Binding.Name)) { continue; } var sep = ImportEndpoint(port, false); if (sep != null) { coll.Add(sep); } } } } }
private static ServiceEndpointCollection ImportEndpoints(MetadataSet metadataSet, IEnumerable <ContractDescription> contracts, MetadataExchangeClient client) { ServiceEndpointCollection endpoints = new ServiceEndpointCollection(); WsdlImporter importer = new WsdlImporter(metadataSet); importer.State.Add("MetadataExchangeClientKey", client); foreach (ContractDescription description in contracts) { importer.KnownContracts.Add(WsdlExporter.WsdlNamingHelper.GetPortTypeQName(description), description); } foreach (ContractDescription description2 in contracts) { foreach (ServiceEndpoint endpoint in importer.ImportEndpoints(description2)) { endpoints.Add(endpoint); } } if (importer.Errors.Count > 0) { TraceWsdlImportErrors(importer); } return(endpoints); }