ServiceDescriptionImporter.AddServiceDescription メソッド
指定した ServiceDescription を ServiceDescriptions コレクションに追加します。
Public Sub AddServiceDescription( _
ByVal serviceDescription As ServiceDescription, _ ByVal appSettingUrlKey As String, _ ByVal appSettingBaseUrl As String _)
[C#]
public void AddServiceDescription(ServiceDescriptionserviceDescription,stringappSettingUrlKey,stringappSettingBaseUrl);
[C++]
public: void AddServiceDescription(ServiceDescription* serviceDescription,String* appSettingUrlKey,String* appSettingBaseUrl);
[JScript]
public function AddServiceDescription(
serviceDescription : ServiceDescription,appSettingUrlKey : String,appSettingBaseUrl : String);
パラメータ
- serviceDescription
コレクションに追加する ServiceDescription インスタンス。 - appSettingUrlKey
serviceDescription パラメータで表されるインスタンスから生成されるプロキシ クラスの、 Url プロパティの初期値を設定します。web.config ファイルの <appsetting> セクションから生成するように指定します。 - appSettingBaseUrl
serviceDescription パラメータで表されるインスタンスから生成されるプロキシ クラスの、 Url プロパティの初期値を設定します。このプロパティの初期値の生成は、このパラメータの値と WSDL ドキュメントの location 属性で指定された URL の組み合わせから行うように指定します。
解説
appSettingUrlKey および appSettingBaseUrl の 2 つの文字列パラメータは、インポートされた ServiceDescription から生成される XML Web サービス プロキシの Url プロパティを生成する方法を指定します。 appSettingUrlKey パラメータは、config キーとしてパラメータ値を使用し、web.config ファイルの <appsettings> セクションから Url プロパティを読み取ることを指定します。 appSettingUrlKey パラメータが null 参照 (Visual Basic では Nothing) または空の文字列の場合、初期値は WSDL (Web Services Description Language) ドキュメント内の location 属性によって決定されます。 Style の値が Server の場合は、 appSettingUrlKey パラメータの値を設定しようとするとエラーが発生します。
appSettingBaseUrl パラメータは、 Url プロパティの初期値の生成を、このパラメータ値と WSDL ドキュメントの location 属性で指定された URL との組み合わせによって行うように指定します。 appSettingUrlKey パラメータも指定する必要があります。 Url プロパティは、相対 URL と web.config ファイルから読み込まれた URL との組み合わせによって構築します (相対 URL は appSettingBaseUrl パラメータと、WSDL で指定された URL から生成されます)。このパラメータが null 参照 (Nothing) または空の文字列である場合、URL はすべて web.config ファイルの値から生成されます。
使用例
' Create a ServiceDescription by reading a .wsdl file.
Dim myServiceDescription As ServiceDescription = ServiceDescription.Read("Sample_vb.wsdl")
Dim myImporter As New ServiceDescriptionImporter()
' Add the ServiceDescription to the ServiceDescriptionImporter.
myImporter.AddServiceDescription(myServiceDescription, "", "")
' Set the protocol name.
myImporter.ProtocolName = "Soap"
Console.WriteLine("ProtocolName : " + myImporter.ProtocolName)
[C#]
// Create a ServiceDescription by reading a .wsdl file.
ServiceDescription myServiceDescription = ServiceDescription.Read("Sample_CS.wsdl");
ServiceDescriptionImporter myImporter = new ServiceDescriptionImporter();
// Add the ServiceDescription to the ServiceDescriptionImporter.
myImporter.AddServiceDescription(myServiceDescription, "", "");
// Set the protocol name.
myImporter.ProtocolName = "Soap";
Console.WriteLine("ProtocolName : " + myImporter.ProtocolName);
[C++]
// Create a ServiceDescription by reading a .wsdl file.
ServiceDescription* myServiceDescription = ServiceDescription::Read(S"Sample_cpp.wsdl");
ServiceDescriptionImporter* myImporter = new ServiceDescriptionImporter();
// Add the ServiceDescription to the ServiceDescriptionImporter.
myImporter->AddServiceDescription(myServiceDescription, S"", S"");
// Set the protocol name.
myImporter->ProtocolName = S"Soap";
Console::WriteLine(S"ProtocolName : {0}", myImporter->ProtocolName);
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
ServiceDescriptionImporter クラス | ServiceDescriptionImporter メンバ | System.Web.Services.Description 名前空間