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


C# DiscoveryClientProtocol.Download方法代码示例

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


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

示例1: GetDocumentNoParse

 private static DiscoveryDocument GetDocumentNoParse(ref string url, DiscoveryClientProtocol client)
 {
     DiscoveryDocument document2;
     DiscoveryDocument document = (DiscoveryDocument) client.Documents[url];
     if (document != null)
     {
         return document;
     }
     string contentType = null;
     Stream stream = client.Download(ref url, ref contentType);
     try
     {
         XmlTextReader xmlReader = new XmlTextReader(new StreamReader(stream, RequestResponseUtils.GetEncoding(contentType))) {
             WhitespaceHandling = WhitespaceHandling.Significant,
             XmlResolver = null,
             DtdProcessing = DtdProcessing.Prohibit
         };
         if (!DiscoveryDocument.CanRead(xmlReader))
         {
             ArgumentException innerException = new ArgumentException(System.Web.Services.Res.GetString("WebInvalidFormat"));
             throw new InvalidOperationException(System.Web.Services.Res.GetString("WebMissingDocument", new object[] { url }), innerException);
         }
         document2 = DiscoveryDocument.Read(xmlReader);
     }
     finally
     {
         stream.Close();
     }
     return document2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:DiscoveryDocumentReference.cs

示例2: ResolveInternal

		internal void ResolveInternal (DiscoveryClientProtocol prot, ServiceDescription wsdl) 
		{
			if (wsdl.Imports == null) return;
			
			foreach (Import import in wsdl.Imports)
			{
				// Make relative uris to absoulte

				Uri uri = new Uri (BaseUri, import.Location);
				string url = uri.ToString ();

				if (prot.Documents.Contains (url)) 	// Already resolved
					continue;

				try
				{
					string contentType = null;
					Stream stream = prot.Download (ref url, ref contentType);
					XmlTextReader reader = new XmlTextReader (url, stream);
					reader.XmlResolver = null;
					reader.MoveToContent ();
					
					DiscoveryReference refe;
					if (ServiceDescription.CanRead (reader))
					{
						ServiceDescription refWsdl = ServiceDescription.Read (reader);
						refe = new ContractReference ();
						refe.ClientProtocol = prot;
						refe.Url = url;
						((ContractReference)refe).ResolveInternal (prot, refWsdl);
						prot.Documents.Add (url, refWsdl);
					}
					else
					{
						XmlSchema schema = XmlSchema.Read (reader, null);
						refe = new SchemaReference ();
						refe.ClientProtocol = prot;
						refe.Url = url;
						prot.Documents.Add (url, schema);
					}
					
					if (!prot.References.Contains (url))
						prot.References.Add (refe);
						
					reader.Close ();
				}
				catch (Exception ex)
				{
					ReportError (url, ex);
				}
			}

			foreach (XmlSchema schema in wsdl.Types.Schemas)
			{
				// the schema itself is not added to the
				// references, but it has to resolve includes.
				Uri uri = BaseUri;
				string url = uri.ToString ();
				SchemaReference refe = new SchemaReference ();
				refe.ClientProtocol = prot;
				refe.Url = url;
				refe.ResolveInternal (prot, schema);
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:64,代码来源:ContractReference.cs

示例3: GetDocumentNoParse

        /// <include file='doc\DiscoveryDocumentReference.uex' path='docs/doc[@for="DiscoveryDocumentReference.GetDocumentNoParse"]/*' />
        /// <devdoc>
        /// Retrieves a discovery document from Url, either out of the ClientProtocol
        /// or from a stream. Does not
        /// </devdoc>
        private static DiscoveryDocument GetDocumentNoParse(ref string url, DiscoveryClientProtocol client) {
            DiscoveryDocument d = (DiscoveryDocument) client.Documents[url];
            if (d != null) {
                return d;
            }

            string contentType = null;

            Stream stream = client.Download(ref url, ref contentType);
            try {
                XmlTextReader reader = new XmlTextReader(new StreamReader(stream, RequestResponseUtils.GetEncoding(contentType)));
                reader.WhitespaceHandling = WhitespaceHandling.Significant;
                reader.XmlResolver = null;
                reader.DtdProcessing = DtdProcessing.Prohibit;
                if (!DiscoveryDocument.CanRead(reader)) {
                    // there is no discovery document at this location
                    ArgumentException exception = new ArgumentException(Res.GetString(Res.WebInvalidFormat));
                    throw new InvalidOperationException(Res.GetString(Res.WebMissingDocument, url), exception);
                }
                return DiscoveryDocument.Read(reader);
            }
            finally {
                stream.Close();
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:30,代码来源:DiscoveryDocumentReference.cs

示例4: ResolveInternal

		internal void ResolveInternal (DiscoveryClientProtocol prot, XmlSchema xsd) 
		{
			if (xsd.Includes.Count == 0) return;
			
			foreach (XmlSchemaExternal ext in xsd.Includes)
			{
				if (ext.SchemaLocation == null)
					continue;

				// Make relative uris to absoulte

				Uri uri = new Uri (BaseUri, ext.SchemaLocation);
				string url = uri.ToString ();

				if (prot.Documents.Contains (url)) 	// Already resolved
					continue;

				try
				{
					string contentType = null;
					Stream stream = prot.Download (ref url, ref contentType);
					XmlTextReader reader = new XmlTextReader (url, stream);
					reader.XmlResolver = null;
					reader.MoveToContent ();
					
					DiscoveryReference refe;
					XmlSchema schema = XmlSchema.Read (reader, null);
					refe = new SchemaReference ();
					refe.ClientProtocol = prot;
					refe.Url = url;
					prot.Documents.Add (url, schema);
					((SchemaReference)refe).ResolveInternal (prot, schema);
					
					if (!prot.References.Contains (url))
						prot.References.Add (refe);
						
					stream.Close ();
				}
				catch (Exception ex)
				{
					ReportError (url, ex);
				}
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:44,代码来源:SchemaReference.cs


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