WebClientProtocol クラスとは? わかりやすく解説

WebClientProtocol クラス

ASP.NET作成されすべての XML Web サービス クライアント プロキシ基本クラス指定します

名前空間: System.Web.Services.Protocols
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

<ComVisibleAttribute(True)> _
Public MustInherit Class
 WebClientProtocol
    Inherits Component
Dim instance As WebClientProtocol
[ComVisibleAttribute(true)] 
public abstract class WebClientProtocol : Component
[ComVisibleAttribute(true)] 
public ref class WebClientProtocol abstract
 : public Component
/** @attribute ComVisibleAttribute(true) */ 
public abstract class WebClientProtocol extends
 Component
ComVisibleAttribute(true) 
public abstract class WebClientProtocol extends
 Component
解説解説

WebClientProtocol クラスプロパティ使用してXML Web サービス要求応答送信するために使用するトランスポート動作制御します。このクラスプロパティは、WebRequestプロパティ割り当てられます。HttpWebRequest などの WebRequest から派生したクラスインスタンスは、ASP.NET作成されXML Web サービストランスポート機構として使用されます。

XML Web サービス通信する場合は、呼び出す XML Web サービス使用する WebClientProtocol から間接または直接派生するプロキシ クラス作成する必要がありますプロキシ クラス手動作成する代わりに、Wsdl.exe ツール使用して指定されXML Web サービスサービス説明からプロキシ クラス作成できますWebClientProtocol は、クライアント プロキシ基本クラスであるため、そのプロパティ作成したプロキシ クラスプロパティは同じものになります。これらのプロパティは、基になるトランスポート要求動作制御するのに役立ちます。たとえば、認証済みXML Web サービス呼び出すためには Credentials プロパティ使用しますWebClientProtocol多数プロパティは、Web 要求を行うために使用される WebRequest オブジェクト初期化使用されます。

使用例使用例

XML Web サービス (Math) を呼び出す ASP.NET Web フォームの例を次に示します。この Web フォームでは、EnterBtn_Click 関数の中で、プロキシ情報クライアント資格情報プロキシ クラス設定してから、リモート XML Web サービス メソッド呼び出します。

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Net"
 %>
<html>
    <script language="VB" runat="server">
    
        Sub EnterBtn_Click(src As Object,
 e As EventArgs)
            Dim math As New
 MyMath.Math()
            
            ' Set the client-side credentials using the Credentials
 property.
            Dim credentials As New
 NetworkCredential("Joe", "password",
 "mydomain")
            math.Credentials = credentials
            
            ' Do not allow the server to redirect the request.
            math.AllowAutoRedirect = False
            
            Dim iTotal As Integer
 = math.Add(Convert.ToInt32(Num1.Text), Convert.ToInt32(Num2.Text))
            Total.Text = "Total: " & iTotal.ToString()
        End Sub
 
    </script>
 
    <body>
       <form action="MathClient.aspx" runat=server>
           
          Enter the two numbers you want to add and
 then press the Total button.
          <p>
          Number 1: <asp:textbox id="Num1" runat=server/>
  +
          Number 2: <asp:textbox id="Num2" runat=server/>
 =
          <asp:button text="Total" Onclick="EnterBtn_Click"
 runat=server/>
          <p>
          <asp:label id="Total"  runat=server/>
          
       </form>
    </body>
 </html>

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Net" %>
<html>
    <script language="C#" runat="server">
       void EnterBtn_Click(Object Src, EventArgs E) 
          {
             MyMath.Math math = new MyMath.Math();

             // Set the client-side credentials using the Credentials
 property.
             ICredentials credentials = new NetworkCredential("Joe"
,"mydomain","password");
             math.Credentials = credentials;
             
             // Do not allow the server to redirect the request.
             math.AllowAutoRedirect = false;
             
             int total = math.Add(Convert.ToInt32(Num1.Text),
 Convert.ToInt32(Num2.Text));
             Total.Text = "Total: " + total.ToString();
         }
 
    </script>
 
    <body>
       <form action="MathClient.aspx" runat=server>
           
          Enter the two numbers you want to add and then press the Total button.
          <p>
          Number 1: <asp:textbox id="Num1" runat=server/>  +
          Number 2: <asp:textbox id="Num2" runat=server/> =
          <asp:button text="Total" Onclick="EnterBtn_Click"
 runat=server/>
          <p>
          <asp:label id="Total"  runat=server/>
          
       </form>
    </body>
 </html>

<%@ Page Language="JSCRIPT" src="source.js" %>
<%@ Import Namespace="System.Net" %>
<html>
    <script language="JSCRIPT" runat="server">
    
        function EnterBtn_Click(src : Object, e : EventArgs){
            var math : MyMath.Math = new MyMath.Math()
            
            // Set the client-side credentials using the Credentials
 property.
            var credentials : NetworkCredential = new
 NetworkCredential("Joe", "password", "mydomain")
            math.Credentials = credentials
            
            // Do not allow the server to redirect the request.
            math.AllowAutoRedirect = false
            
            var iTotal : int = math.Add(Convert.ToInt32(Num1.Text),
 Convert.ToInt32(Num2.Text))
            Total.Text = "Total: " + iTotal.ToString()
        }
 
    </script>
 
    <body>
       <form action="MathClient.aspx" runat=server>
           
          Enter the two numbers you want to add and then press the Total button.
          <p>
          Number 1: <asp:textbox id="Num1" runat=server/>  +
          Number 2: <asp:textbox id="Num2" runat=server/> =
          <asp:button text="Total" Onclick="EnterBtn_Click"
 runat=server/>
          <p>
          <asp:label id="Total"  runat=server/>
          
       </form>
    </body>
 </html>

継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
      System.Web.Services.Protocols.WebClientProtocol
         System.Web.Services.Protocols.HttpWebClientProtocol
スレッド セーフスレッド セーフ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebClientProtocol メンバ
System.Web.Services.Protocols 名前空間
SoapHttpClientProtocol クラス
HttpWebRequest



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「WebClientProtocol クラス」の関連用語

WebClientProtocol クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebClientProtocol クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS