internal void HandleSection(MetadataSection section) { if (section.Metadata is MetadataSet) { foreach (MetadataSection innerSection in ((MetadataSet)section.Metadata).MetadataSections) { innerSection.SourceUrl = section.SourceUrl; this.HandleSection(innerSection); } } else if (section.Metadata is MetadataReference) { if (this.resolveMetadataReferences) { EndpointAddress address = ((MetadataReference)section.Metadata).Address; MetadataRetriever retriever = new MetadataReferenceRetriever(address, this.resolver, section.Dialect, section.Identifier); this.stackedRetrievers.Push(retriever); } else { this.metadataSet.MetadataSections.Add(section); } } else if (section.Metadata is MetadataLocation) { if (this.resolveMetadataReferences) { string location = ((MetadataLocation)section.Metadata).Location; MetadataRetriever retriever = new MetadataLocationRetriever(this.CreateUri(section.SourceUrl, location), this.resolver, section.Dialect, section.Identifier); this.stackedRetrievers.Push(retriever); } else { this.metadataSet.MetadataSections.Add(section); } } else if (section.Metadata is WsdlNS.ServiceDescription) { if (this.resolveMetadataReferences) { this.HandleWsdlImports(section); } this.metadataSet.MetadataSections.Add(section); } else if (section.Metadata is XsdNS.XmlSchema) { if (this.resolveMetadataReferences) { this.HandleSchemaImports(section); } this.metadataSet.MetadataSections.Add(section); } else { this.metadataSet.MetadataSections.Add(section); } }
public MetadataSet GetMetadata(Uri address, MetadataExchangeClientMode mode) { Validate(address, mode); MetadataRetriever retriever; if (mode == MetadataExchangeClientMode.HttpGet) { retriever = new MetadataLocationRetriever(address, this); } else { retriever = new MetadataReferenceRetriever(new EndpointAddress(address), this); } return GetMetadata(retriever); }