当前位置: 首页>>代码示例>>C#>>正文


C# DiscoveryClientProtocol.ResolveAll方法代码示例

本文整理汇总了C#中System.Web.Services.Discovery.DiscoveryClientProtocol.ResolveAll方法的典型用法代码示例。如果您正苦于以下问题:C# DiscoveryClientProtocol.ResolveAll方法的具体用法?C# DiscoveryClientProtocol.ResolveAll怎么用?C# DiscoveryClientProtocol.ResolveAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Services.Discovery.DiscoveryClientProtocol的用法示例。


在下文中一共展示了DiscoveryClientProtocol.ResolveAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DownloadFile

        //MetadataExchangeClient can only download data from a local wsdl file, if it is a file we user the DiscoveryClientProtocol
        void DownloadFile(out List<wsdlDescription.ServiceDescription> descriptions, out List<XmlSchema> schemas)
        {
            descriptions = new List<wsdlDescription.ServiceDescription>();
            schemas = new List<XmlSchema>();

            DiscoveryClientProtocol client = new DiscoveryClientProtocol();

            //download document
            client.AllowAutoRedirect = true;
            client.Timeout = _timeoutInSeconds * 1000;

            client.Documents.Clear();
            client.DiscoverAny(_wsdlEndpoint);

            client.ResolveAll();

            foreach (var v in client.Documents.Values) {
                if (v is wsdlDescription.ServiceDescription) {
                    descriptions.Add((wsdlDescription.ServiceDescription)v);
                }
                else if (v is XmlSchema) {
                    schemas.Add((XmlSchema)v);
                }
            }
        }
开发者ID:umabiel,项目名称:WsdlUI,代码行数:26,代码来源:WsdlDownload.cs

示例2: DiscoverDocuments

        DiscoveryClientDocumentCollection DiscoverDocuments()
        {
            var protocol = new DiscoveryClientProtocol {
                AllowAutoRedirect = true,
                Credentials = credentials ?? CredentialCache.DefaultCredentials
            };

            protocol.DiscoverAny(uri);
            protocol.ResolveAll();

            return protocol.Documents;
        }
开发者ID:phaufe,项目名称:SoapContextDriver,代码行数:12,代码来源:Discovery.cs

示例3: ReadServiceDescriptionImporter

		/// <summary>Read the specified protocol into an ServiceDescriptionImporter.</summary>
		/// <param name="protocol">A DiscoveryClientProtocol containing the service protocol detail.</param>
		/// <returns>A ServiceDescriptionImporter for the specified protocol.</returns>
		public static ServiceDescriptionImporter ReadServiceDescriptionImporter(DiscoveryClientProtocol protocol)
		{
   			// Service Description Importer
			ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
			importer.ProtocolName = "Soap";
			// Add all the schemas and service descriptions to the importer
			protocol.ResolveAll ();
			foreach (object doc in protocol.Documents.Values)
			{
				if (doc is ServiceDescription)
					importer.AddServiceDescription((ServiceDescription)doc, null, null);
				else if (doc is XmlSchema)
					importer.Schemas.Add((XmlSchema)doc);
			}			
			return importer;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:19,代码来源:Library.cs

示例4: Resolve

		/// <summary>
		/// Resolves metadata from the specified URL.
		/// </summary>
		/// <param name="url">The URL.</param>
		/// <returns>A list of metadata sections.</returns>
		public static IEnumerable<MetadataSection> Resolve(string url)
		{
			MetadataSet metadataSet = new MetadataSet();
			DiscoveryClientProtocol discoveryClient = new DiscoveryClientProtocol
			{
				UseDefaultCredentials = true,
				AllowAutoRedirect = true
			};
			discoveryClient.DiscoverAny(url);
			discoveryClient.ResolveAll();
			foreach (object document in discoveryClient.Documents.Values)
			{
				AddDocumentToSet(metadataSet, document);
			}

			return metadataSet.MetadataSections;
		}
开发者ID:gtri-iead,项目名称:LEXS-NET-Sample-Implementation-3.1.4,代码行数:22,代码来源:DiscoveryMetadataResolver.cs

示例5: GetServiceDescription

        /// <summary>
        /// Gets the web service description from the supplied URL.
        /// </summary>
        /// <param name="url">
        /// The URL where XML Web services discovery begins.
        /// </param>
        /// <param name="username">
        /// The username.
        /// </param>
        /// <param name="password">
        /// The password.
        /// </param>
        /// <returns>
        /// The <see cref="WebServiceDescription"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="url"/> parameter is null.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// The <paramref name="url"/> parameter is a valid URL, but does not point to a valid discovery document, service description, or XSD schema.
        /// </exception>
        public WebServiceDescription GetServiceDescription(string url, string username, string password)
        {
            if (url == null)
                throw new ArgumentNullException("url");

            url = url.Trim();

            var protocol = new DiscoveryClientProtocol { AllowAutoRedirect = true, Credentials = CredentialCache.DefaultCredentials };
            if (!string.IsNullOrEmpty(username))
                protocol.Credentials = new NetworkCredential(username, password);

            try
            {
                protocol.DiscoverAny(url);
            }
            catch (InvalidOperationException)
            {
                if (!url.EndsWith("?WSDL", StringComparison.InvariantCultureIgnoreCase))
                    protocol.DiscoverAny(url + "?WSDL");
                else
                    throw;
            }

            protocol.ResolveAll();

            var serviceDescription = new WebServiceDescription();

            foreach (DictionaryEntry entry in protocol.References)
            {
                var contractReference = entry.Value as ContractReference;

                if (contractReference != null)
                    serviceDescription.ServiceDescriptions.Add(contractReference.Contract);

                var schemaReference = entry.Value as SchemaReference;

                if (schemaReference != null)
                    serviceDescription.XmlSchemas.Add(schemaReference.Schema);
            }

            return serviceDescription;
        }
开发者ID:mparsin,项目名称:Elements,代码行数:63,代码来源:WebServiceDescriptionRetriever.cs

示例6: ReadServiceDescriptionImporter

		/// <summary>Read the specified protocol into an ServiceDescriptionImporter.</summary>
		/// <param name="protocol">A DiscoveryClientProtocol containing the service protocol detail.</param>
		/// <returns>A ServiceDescriptionImporter for the specified protocol.</returns>
		public static ServiceDescriptionImporter ReadServiceDescriptionImporter(DiscoveryClientProtocol protocol)
		{
   			// Service Description Importer
			var importer = new ServiceDescriptionImporter();
			importer.ProtocolName = "Soap";
			// Add all the schemas and service descriptions to the importer
			protocol.ResolveAll ();
			foreach (object doc in protocol.Documents.Values)
			{
				var serviceDescription = doc as ServiceDescription;
				if (serviceDescription != null)
					importer.AddServiceDescription (serviceDescription, null, null);
				else {
					var xmlSchema = doc as XmlSchema;
					if (xmlSchema != null)
						importer.Schemas.Add (xmlSchema);
				}
			}			
			return importer;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:23,代码来源:Library.cs

示例7: ReadWriteTest

		public void ReadWriteTest ()
		{
			string directory = Path.Combine (Path.GetTempPath (), Path.GetRandomFileName ());
			Directory.CreateDirectory (directory);
			try {
				string url = "http://www.w3schools.com/WebServices/TempConvert.asmx";
				var p1 = new DiscoveryClientProtocol ();
				p1.DiscoverAny (url);
				p1.ResolveAll ();

				p1.WriteAll (directory, "Reference.map");

				var p2 = new DiscoveryClientProtocol ();
				var results = p2.ReadAll (Path.Combine (directory, "Reference.map"));

				Assert.AreEqual (2, results.Count);
				Assert.AreEqual ("TempConvert.disco", results [0].Filename);
				Assert.AreEqual ("TempConvert.wsdl", results [1].Filename);
			} finally {
				Directory.Delete (directory, true);
			}
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:22,代码来源:DiscoveryClientProtocolTest.cs

示例8: DownloadMetadata

        public Collection<MetadataSection> DownloadMetadata(string serviceUrl)
        {
            Uri serviceUri = new Uri(serviceUrl);

            Collection<MetadataSection> metadataSections;
            if (TryDownloadByMetadataExchangeClient(serviceUri, out metadataSections))
            {
                return metadataSections;
            }
            else
            {
                if (TryDownloadByMetadataExchangeClient(GetDefaultMexUri(serviceUri), out metadataSections))
                {
                    return metadataSections;
                }
            }

            bool supporstDiscoveryClientProtocol = serviceUri.Scheme == Uri.UriSchemeHttp || serviceUri.Scheme == Uri.UriSchemeHttps;
            if (supporstDiscoveryClientProtocol)
            {
                DiscoveryClientProtocol disco = new DiscoveryClientProtocol();
                disco.AllowAutoRedirect = true;
                disco.UseDefaultCredentials = true;
                disco.DiscoverAny(serviceUrl);
                disco.ResolveAll();

                Collection<MetadataSection> result = new Collection<MetadataSection>();
                if (disco.Documents.Values != null)
                {
                    foreach (object document in disco.Documents.Values)
                    {
                        AddDocumentToResults(document, result);
                    }
                }
                return result;
            }
            return null;
        }
开发者ID:QuickOrBeDead,项目名称:Dynamic-Wcf-Client-Proxy,代码行数:38,代码来源:ServiceMetadataDownloader.cs

示例9: Generate

        public model.WebSvc Generate(string filePath)
        {
            List<wsdlDescription.ServiceDescription> descriptions = new List<wsdlDescription.ServiceDescription>();
            List<XmlSchema> schemas = new List<XmlSchema>();

            DiscoveryClientProtocol client = new DiscoveryClientProtocol();

            //load Document from file
            client.AllowAutoRedirect = true;
            client.Documents.Clear();
            client.DiscoverAny(filePath);
            client.ResolveAll();

            foreach (var v in client.Documents.Values) {
                if (v is wsdlDescription.ServiceDescription) {
                    descriptions.Add((wsdlDescription.ServiceDescription)v);
                }
                else if (v is XmlSchema) {
                    schemas.Add((XmlSchema)v);
                }
            }

            return Generate(filePath, descriptions, schemas);
        }
开发者ID:umabiel,项目名称:WsdlUI,代码行数:24,代码来源:Parser.cs

示例10: DownloadMetadata

        private void DownloadMetadata()
        {
            EndpointAddress epr = new EndpointAddress(this.wsdlUri);

            DiscoveryClientProtocol disco = new DiscoveryClientProtocol();
            disco.AllowAutoRedirect = true;
            disco.UseDefaultCredentials = true;
            disco.DiscoverAny(this.wsdlUri);
            disco.ResolveAll();

            Collection<MetadataSection> results = new Collection<MetadataSection>();
            foreach (object document in disco.Documents.Values)
            {
                AddDocumentToResults(document, results);
            }
            this.metadataCollection = results;
        }
开发者ID:ravish27,项目名称:WCFQuickSamples,代码行数:17,代码来源:DynamicProxyFactory.cs

示例11: ProcessRemoteUrls

 private void ProcessRemoteUrls(DiscoveryClientProtocol client, StringCollection urls, XmlSchemas schemas,
                                ServiceDescriptionCollection descriptions)
 {
     foreach (string text1 in urls)
     {
         try
         {
             DiscoveryDocument document1 = client.DiscoverAny(text1);
             client.ResolveAll();
             continue;
         }
         catch (Exception exception1)
         {
             throw new InvalidOperationException("General Error " + text1, exception1);
         }
     }
     foreach (DictionaryEntry entry1 in client.Documents)
     {
         AddDocument((string) entry1.Key, entry1.Value, schemas, descriptions);
     }
 }
开发者ID:irdetocustomercentral,项目名称:WebServiceStudio,代码行数:21,代码来源:Wsdl.cs

示例12: DownloadWeb

        //TODO: FB client.GetMetadata is not working working on linux, instead use DiscoveryClientProtocol.
        //this means that mex bindings are currently not supported on linux
        void DownloadWeb(model.IProxy proxy, out List<wsdlDescription.ServiceDescription> descriptions, out List<XmlSchema> schemas)
        {
            DiscoveryClientProtocol client = new DiscoveryClientProtocol();

            if (proxy.ProxyType == model.Proxy.EProxyType.Enabled) {

                client.Proxy = new System.Net.WebProxy(proxy.Host, proxy.Port);
                client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
            }

            descriptions = new List<wsdlDescription.ServiceDescription>();
            schemas = new List<XmlSchema>();

            //download document
            client.AllowAutoRedirect = true;
            client.Timeout = _timeoutInSeconds * 1000;

            client.Documents.Clear();
            client.DiscoverAny(_wsdlEndpoint);
            client.ResolveAll();

            //generate stub
            foreach (var v in client.Documents.Values) {
                if (v is wsdlDescription.ServiceDescription) {
                    descriptions.Add((wsdlDescription.ServiceDescription)v);
                }
                else if (v is XmlSchema) {
                    schemas.Add((XmlSchema)v);
                }
            }
        }
开发者ID:umabiel,项目名称:WsdlUI,代码行数:33,代码来源:WsdlDownload.cs

示例13: ProcessRemoteUrls

 private void ProcessRemoteUrls(DiscoveryClientProtocol client, StringCollection urls, XmlSchemas schemas, ServiceDescriptionCollection descriptions)
 {
     StringEnumerator enumerator = urls.GetEnumerator();
     while (enumerator.MoveNext())
     {
         string current = enumerator.Current;
         try
         {
             DiscoveryDocument document = client.DiscoverAny(current);
             client.ResolveAll();
             continue;
         }
         catch (Exception exception)
         {
             throw new InvalidOperationException("General Error " + current, exception);
         }
     }
     IDictionaryEnumerator enumerator2 = client.Documents.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         DictionaryEntry entry = (DictionaryEntry)enumerator2.Current;
         this.AddDocument((string)entry.Key, entry.Value, schemas, descriptions);
     }
 }
开发者ID:hdougie,项目名称:webservicestudio2,代码行数:24,代码来源:Wsdl.cs

示例14: GetWsDocuments

        /// <summary>
        /// Gets XML Web Services documents from a Spring resource.
        /// </summary>
        private DiscoveryClientDocumentCollection GetWsDocuments(IResource resource)
        {
            try
            {
                if (ServiceUri is UrlResource || 
                    ServiceUri is FileSystemResource)
                {
                    DiscoveryClientProtocol dcProtocol = new DiscoveryClientProtocol();
                    dcProtocol.AllowAutoRedirect = true;
                    dcProtocol.Credentials = CreateCredentials();
                    dcProtocol.Proxy = ConfigureProxy();
                    dcProtocol.DiscoverAny(resource.Uri.AbsoluteUri);
                    dcProtocol.ResolveAll();

                    return dcProtocol.Documents;
                }
                else
                {
                    DiscoveryClientDocumentCollection dcdc = new DiscoveryClientDocumentCollection();
                    dcdc[resource.Description] = ServiceDescription.Read(resource.InputStream);
                    return dcdc;
                }
            }
            catch (Exception ex)
            {
                throw new ArgumentException(String.Format("Couldn't retrieve the description of the web service located at '{0}'.", resource.Description), ex);
            }
        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:31,代码来源:WebServiceProxyFactory.cs

示例15: GenerateWebServiceProxyAssembly

		private Assembly GenerateWebServiceProxyAssembly(string NameSpace, string ClassName)
		{
			object obj = null;
			Assembly assembly;
			DiscoveryClientProtocol discoveryClientProtocol = new DiscoveryClientProtocol();
			if (this._usedefaultcredential.IsPresent)
			{
				discoveryClientProtocol.UseDefaultCredentials = true;
			}
			if (base.ParameterSetName.Equals("Credential", StringComparison.OrdinalIgnoreCase))
			{
				discoveryClientProtocol.Credentials = this._credential.GetNetworkCredential();
			}
			try
			{
				discoveryClientProtocol.AllowAutoRedirect = true;
				discoveryClientProtocol.DiscoverAny(this._uri.ToString());
				discoveryClientProtocol.ResolveAll();
				goto Label0;
			}
			catch (WebException webException1)
			{
				WebException webException = webException1;
				ErrorRecord errorRecord = new ErrorRecord(webException, "WebException", ErrorCategory.ObjectNotFound, this._uri);
				if (webException.InnerException != null)
				{
					errorRecord.ErrorDetails = new ErrorDetails(webException.InnerException.Message);
				}
				base.WriteError(errorRecord);
				assembly = null;
			}
			catch (InvalidOperationException invalidOperationException1)
			{
				InvalidOperationException invalidOperationException = invalidOperationException1;
				ErrorRecord errorRecord1 = new ErrorRecord(invalidOperationException, "InvalidOperationException", ErrorCategory.InvalidOperation, this._uri);
				base.WriteError(errorRecord1);
				assembly = null;
			}
			return assembly;
		Label0:
			CodeNamespace codeNamespace = new CodeNamespace();
			if (!string.IsNullOrEmpty(NameSpace))
			{
				codeNamespace.Name = NameSpace;
			}
			if (!string.IsNullOrEmpty(ClassName))
			{
				CodeTypeDeclaration codeTypeDeclaration = new CodeTypeDeclaration(ClassName);
				codeTypeDeclaration.IsClass = true;
				codeTypeDeclaration.Attributes = MemberAttributes.Public;
				codeNamespace.Types.Add(codeTypeDeclaration);
			}
			WebReference webReference = new WebReference(discoveryClientProtocol.Documents, codeNamespace);
			WebReferenceCollection webReferenceCollection = new WebReferenceCollection();
			webReferenceCollection.Add(webReference);
			CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
			codeCompileUnit.Namespaces.Add(codeNamespace);
			WebReferenceOptions webReferenceOption = new WebReferenceOptions();
			webReferenceOption.CodeGenerationOptions = CodeGenerationOptions.GenerateProperties | CodeGenerationOptions.GenerateNewAsync | CodeGenerationOptions.GenerateOldAsync;
			webReferenceOption.Verbose = true;
			CSharpCodeProvider cSharpCodeProvider = new CSharpCodeProvider();
			StringCollection stringCollections = ServiceDescriptionImporter.GenerateWebReferences(webReferenceCollection, cSharpCodeProvider, codeCompileUnit, webReferenceOption);
			StringBuilder stringBuilder = new StringBuilder();
			StringWriter stringWriter = new StringWriter(stringBuilder, CultureInfo.InvariantCulture);
			try
			{
				cSharpCodeProvider.GenerateCodeFromCompileUnit(codeCompileUnit, stringWriter, null);
			}
			catch (NotImplementedException notImplementedException1)
			{
				NotImplementedException notImplementedException = notImplementedException1;
				ErrorRecord errorRecord2 = new ErrorRecord(notImplementedException, "NotImplementedException", ErrorCategory.ObjectNotFound, this._uri);
				base.WriteError(errorRecord2);
			}
			this.sourceHash = stringBuilder.ToString().GetHashCode();
			if (!NewWebServiceProxy.srccodeCache.ContainsKey(this.sourceHash))
			{
				CompilerParameters compilerParameter = new CompilerParameters();
				CompilerResults compilerResult = null;
				foreach (string str in stringCollections)
				{
					base.WriteWarning(str);
				}
				compilerParameter.ReferencedAssemblies.Add("System.dll");
				compilerParameter.ReferencedAssemblies.Add("System.Data.dll");
				compilerParameter.ReferencedAssemblies.Add("System.Xml.dll");
				compilerParameter.ReferencedAssemblies.Add("System.Web.Services.dll");
				compilerParameter.ReferencedAssemblies.Add(Assembly.GetExecutingAssembly().Location);
				this.GetReferencedAssemblies(typeof(Cmdlet).Assembly, compilerParameter);
				compilerParameter.GenerateInMemory = true;
				compilerParameter.TreatWarningsAsErrors = false;
				compilerParameter.WarningLevel = 4;
				compilerParameter.GenerateExecutable = false;
				try
				{
					string[] strArrays = new string[1];
					strArrays[0] = stringBuilder.ToString();
					compilerResult = cSharpCodeProvider.CompileAssemblyFromSource(compilerParameter, strArrays);
				}
				catch (NotImplementedException notImplementedException3)
//.........这里部分代码省略.........
开发者ID:nickchal,项目名称:pash,代码行数:101,代码来源:NewWebServiceProxy.cs


注:本文中的System.Web.Services.Discovery.DiscoveryClientProtocol.ResolveAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。