次の方法で共有


WebClientProtocol.Url プロパティ

クライアントが要求している XML Web サービスのベース URL を取得または設定します。

Public Property Url As String
[C#]
public string Url {get; set;}
[C++]
public: __property String* get_Url();public: __property void set_Url(String*);
[JScript]
public function get Url() : String;public function set Url(String);

プロパティ値

クライアントが要求している XML Web サービスのベース URL。既定値は Empty です。

解説

Wsdl.exe を使用して生成されたプロキシ クラスは、使用するクライアントに対して既定の Url プロパティを設定します。既定の Url は、プロキシ クラスの生成元のサービスの説明に指定されている位置属性により決定されます。

HttpGetClientProtocolHttpPostClientProtocol など、特定のプロトコルをサポートしている派生クラスは、XML Web サービス要求を行うために、 Url に情報を追加する場合があります。

プロキシ クラスの生成元である同じサービスの説明を実装している任意の XML Web サービスを参照するために、 Url プロパティを変更できます。

使用例

math XML Web サービスの Url プロパティを Web サーバー http:// www.contoso.com に変更する例を次に示します。

 
' Set the URL property to a different Web server than that described in the
' service description.
math.Url = "https://www.contoso.com/math.asmx"
Dim total As Integer = math.Add(Convert.ToInt32(Num1.Text), _
                                 Convert.ToInt32(Num2.Text))


[C#] 
// Set the URL property to a different Web server than that described in the
// service description.
math.Url = "https://www.contoso.com/math.asmx";
int total = math.Add(Convert.ToInt32(Num1.Text), Convert.ToInt32(Num2.Text));


[C++] 
// Set the URL property to a different Web server than that described in the
// service description.
math->Url = S"https://www.contoso.com/math.asmx";
int total = math->Add(Convert::ToInt32(Num1.Text), Convert::ToInt32(Num2.Text));


[JScript] 
// Set the URL property to a different Web server than that described in the
// service description.
math.Url = "https://www.contoso.com/math.asmx"
var total : int = math.Add(Convert.ToInt32(Num1.Text), Convert.ToInt32(Num2.Text))

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

WebClientProtocol クラス | WebClientProtocol メンバ | System.Web.Services.Protocols 名前空間