次の方法で共有


WebReference コンストラクター

定義

WebReference クラスの新しいインスタンスを初期化します。

オーバーロード

WebReference()
WebReference(DiscoveryClientDocumentCollection, CodeNamespace)

説明のドキュメントのコレクションおよびプロキシ コード名前空間を指定して、WebReference クラスの新しいインスタンスを初期化します。

WebReference(DiscoveryClientDocumentCollection, CodeNamespace, String, String)

指定したデータを使用して、WebReference クラスの新しいインスタンスを初期化します。

WebReference(DiscoveryClientDocumentCollection, CodeNamespace, String, String, String)

指定したデータを使用して、WebReference クラスの新しいインスタンスを初期化します。

WebReference()

public:
 WebReference();
public WebReference ();
Public Sub New ()

適用対象

WebReference(DiscoveryClientDocumentCollection, CodeNamespace)

説明のドキュメントのコレクションおよびプロキシ コード名前空間を指定して、WebReference クラスの新しいインスタンスを初期化します。

public:
 WebReference(System::Web::Services::Discovery::DiscoveryClientDocumentCollection ^ documents, System::CodeDom::CodeNamespace ^ proxyCode);
public WebReference (System.Web.Services.Discovery.DiscoveryClientDocumentCollection documents, System.CodeDom.CodeNamespace proxyCode);
new System.Web.Services.Description.WebReference : System.Web.Services.Discovery.DiscoveryClientDocumentCollection * System.CodeDom.CodeNamespace -> System.Web.Services.Description.WebReference
Public Sub New (documents As DiscoveryClientDocumentCollection, proxyCode As CodeNamespace)

パラメーター

documents
DiscoveryClientDocumentCollection

説明のドキュメントのコレクションを指定するDiscoveryClientDocumentCollection

proxyCode
CodeNamespace

コード コンパイルの名前空間を指定する CodeNamespace

次のコード例は、このコンストラクターの使用方法を示しています。 このコード例は、WebReference クラスのために提供されている大規模な例の一部です。

// Create a web referernce using the WSDL collection.
WebReference reference = new WebReference(wsdlCollection, space);
reference.ProtocolName = "Soap12";

注釈

コレクションにはdocuments、オブジェクトGenerateWebReferencesのみをServiceDescriptionXmlSchema含める必要があります。メソッドはオブジェクトを解釈DiscoveryDocumentできません。

適用対象

WebReference(DiscoveryClientDocumentCollection, CodeNamespace, String, String)

指定したデータを使用して、WebReference クラスの新しいインスタンスを初期化します。

public:
 WebReference(System::Web::Services::Discovery::DiscoveryClientDocumentCollection ^ documents, System::CodeDom::CodeNamespace ^ proxyCode, System::String ^ appSettingUrlKey, System::String ^ appSettingBaseUrl);
public WebReference (System.Web.Services.Discovery.DiscoveryClientDocumentCollection documents, System.CodeDom.CodeNamespace proxyCode, string appSettingUrlKey, string appSettingBaseUrl);
new System.Web.Services.Description.WebReference : System.Web.Services.Discovery.DiscoveryClientDocumentCollection * System.CodeDom.CodeNamespace * string * string -> System.Web.Services.Description.WebReference
Public Sub New (documents As DiscoveryClientDocumentCollection, proxyCode As CodeNamespace, appSettingUrlKey As String, appSettingBaseUrl As String)

パラメーター

documents
DiscoveryClientDocumentCollection

説明のドキュメントのコレクションを指定するDiscoveryClientDocumentCollection

proxyCode
CodeNamespace

コード コンパイルの名前空間を指定する CodeNamespace

appSettingUrlKey
String

Web 参照の URL キー。

appSettingBaseUrl
String

Web 参照のベース URL。

注釈

コレクションにはdocuments、オブジェクトGenerateWebReferencesのみをServiceDescriptionXmlSchema含める必要があります。メソッドはオブジェクトを解釈DiscoveryDocumentできません。

適用対象

WebReference(DiscoveryClientDocumentCollection, CodeNamespace, String, String, String)

指定したデータを使用して、WebReference クラスの新しいインスタンスを初期化します。

public:
 WebReference(System::Web::Services::Discovery::DiscoveryClientDocumentCollection ^ documents, System::CodeDom::CodeNamespace ^ proxyCode, System::String ^ protocolName, System::String ^ appSettingUrlKey, System::String ^ appSettingBaseUrl);
public WebReference (System.Web.Services.Discovery.DiscoveryClientDocumentCollection documents, System.CodeDom.CodeNamespace proxyCode, string protocolName, string appSettingUrlKey, string appSettingBaseUrl);
new System.Web.Services.Description.WebReference : System.Web.Services.Discovery.DiscoveryClientDocumentCollection * System.CodeDom.CodeNamespace * string * string * string -> System.Web.Services.Description.WebReference
Public Sub New (documents As DiscoveryClientDocumentCollection, proxyCode As CodeNamespace, protocolName As String, appSettingUrlKey As String, appSettingBaseUrl As String)

パラメーター

documents
DiscoveryClientDocumentCollection

説明のドキュメントのコレクションを指定するDiscoveryClientDocumentCollection

proxyCode
CodeNamespace

コード コンパイルの名前空間を指定する CodeNamespace

protocolName
String

XML Web サービスによって使用されるプロトコル。

appSettingUrlKey
String

Web 参照の URL キー。

appSettingBaseUrl
String

Web 参照のベース URL。

次のコード例は、このコンストラクターの使用方法を示しています。

// 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);
}

注釈

コレクションにはdocuments、オブジェクトGenerateWebReferencesのみをServiceDescriptionXmlSchema含める必要があります。メソッドはオブジェクトを解釈DiscoveryDocumentできません。

適用対象