WebReference.Warnings 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取导入 Web 服务描述语言 (WSDL) 服务说明文档时所生成警告的集合。
public:
property System::Web::Services::Description::ServiceDescriptionImportWarnings Warnings { System::Web::Services::Description::ServiceDescriptionImportWarnings get(); void set(System::Web::Services::Description::ServiceDescriptionImportWarnings value); };
public System.Web.Services.Description.ServiceDescriptionImportWarnings Warnings { get; set; }
member this.Warnings : System.Web.Services.Description.ServiceDescriptionImportWarnings with get, set
Public Property Warnings As ServiceDescriptionImportWarnings
属性值
导入 WSDL 服务说明文档时所生成警告的 ServiceDescriptionImportWarnings 集合。
示例
下面的代码示例说明如何使用 Warnings 属性。
// Read in a WSDL service description.
string url = "http://www.contoso.com/Example/WebService.asmx?WSDL";
XmlTextReader reader = new XmlTextReader(url);
ServiceDescription wsdl = ServiceDescription.Read(reader);
// Create a WSDL collection.
DiscoveryClientDocumentCollection wsdlCollection =
new DiscoveryClientDocumentCollection();
wsdlCollection.Add(url, wsdl);
// Create a namespace.
CodeNamespace proxyNamespace = new CodeNamespace("ExampleNamespace");
// Create a web reference using the WSDL collection.
string baseUrl = "http://www.contoso.com";
string urlKey = "ExampleUrlKey";
string protocolName = "Soap12";
WebReference reference = new WebReference(
wsdlCollection, proxyNamespace, protocolName, urlKey, baseUrl);
// Print some information about the web reference.
Console.WriteLine("The WebReference object contains {0} document(s).",
reference.Documents.Count);
Console.WriteLine("The protocol name is {0}.", reference.ProtocolName);
Console.WriteLine("The base URL is {0}.", reference.AppSettingBaseUrl);
Console.WriteLine("The URL key is {0}.", reference.AppSettingUrlKey);
// Print some information about the proxy code namespace.
Console.WriteLine("The proxy code namespace is {0}.",
reference.ProxyCode.Name);
// Print some information about the validation warnings.
Console.WriteLine("There are {0} validation warnings.",
reference.ValidationWarnings.Count);
// Print some information about the warnings.
if (reference.Warnings == 0)
{
Console.WriteLine("There are no warnings.");
}
else
{
Console.WriteLine("Warnings: " + reference.Warnings);
}