HttpGetClientProtocol クラス

定義

HTTP-GET プロトコルを使用する XML Web サービス クライアント プロキシの基本クラス。

public ref class HttpGetClientProtocol : System::Web::Services::Protocols::HttpSimpleClientProtocol
public class HttpGetClientProtocol : System.Web.Services.Protocols.HttpSimpleClientProtocol
type HttpGetClientProtocol = class
    inherit HttpSimpleClientProtocol
Public Class HttpGetClientProtocol
Inherits HttpSimpleClientProtocol
継承

次の例は、 Math XML Web サービスの Wsdl.exe によって生成されるプロキシ クラスです。 プロキシ クラスは、抽象HttpGetClientProtocol クラスから派生するHttpSimpleClientProtocolから派生します。

#using <System.Web.Services.dll>
#using <System.Xml.dll>
#using <System.dll>

using namespace System::Diagnostics;
using namespace System::Xml::Serialization;
using namespace System;
using namespace System::Web::Services::Protocols;
using namespace System::Web::Services;

public ref class MyMath: public System::Web::Services::Protocols::HttpGetClientProtocol
{
public:

   [System::Diagnostics::DebuggerStepThroughAttribute]
   MyMath()
   {
      this->Url = "http://www.contoso.com/math.asmx";
   }

   [System::Diagnostics::DebuggerStepThroughAttribute]
   [System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid,
   System::Web::Services::Protocols::UrlParameterWriter::typeid)]
   [returnvalue:System::Xml::Serialization::XmlRootAttribute("snippet1>",Namespace="http://www.contoso.com/",IsNullable=false)]
   int Add( String^ num1, String^ num2 )
   {
      array<Object^>^temp0 = {num1,num2};
      return  *dynamic_cast<int^>(this->Invoke( "Add", (String::Concat( this->Url, "/Add" )), temp0 ));
   }

   [System::Diagnostics::DebuggerStepThroughAttribute]
   System::IAsyncResult^ BeginAdd( String^ num1, String^ num2, System::AsyncCallback^ callback, Object^ asyncState )
   {
      array<Object^>^temp1 = {num1,num2};
      return this->BeginInvoke( "Add", (String::Concat( this->Url, "/Add" )), temp1, callback, asyncState );
   }

   [System::Diagnostics::DebuggerStepThroughAttribute]
   int EndAdd( System::IAsyncResult^ asyncResult )
   {
      return  *dynamic_cast<int^>(this->EndInvoke( asyncResult ));
   }
};
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;

public class MyMath : System.Web.Services.Protocols.HttpGetClientProtocol {

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    public MyMath()
    {
        this.Url = "http://www.contoso.com/math.asmx";
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.Web.Services.Protocols.HttpMethodAttribute(typeof(System.Web.Services.Protocols.XmlReturnReader), typeof(System.Web.Services.Protocols.UrlParameterWriter))]
    [return: System.Xml.Serialization.XmlRootAttribute("int", Namespace = "http://www.contoso.com/", IsNullable = false)]
    public int Add(string num1, string num2)
    {
        return ((int)(this.Invoke("Add", (this.Url + "/Add"),
            new object[] { num1, num2 })));
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    public System.IAsyncResult BeginAdd(string num1, string num2, System.AsyncCallback callback, object asyncState)
    {
        return this.BeginInvoke("Add", (this.Url + "/Add"),
            new object[] { num1, num2 }, callback, asyncState);
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    public int EndAdd(System.IAsyncResult asyncResult)
    {
        return ((int)(this.EndInvoke(asyncResult)));
    }
}
Option Strict On
Option Explicit On

Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization


Public Class MyMath
    Inherits System.Web.Services.Protocols.HttpGetClientProtocol
    
    <System.Diagnostics.DebuggerStepThroughAttribute()>  _
    Public Sub New()
        MyBase.New
        Me.Url = "http://www.contoso.com/math.asmx"
    End Sub
    
    <System.Diagnostics.DebuggerStepThroughAttribute(),  _
     System.Web.Services.Protocols.HttpMethodAttribute(GetType(System.Web.Services.Protocols.XmlReturnReader), GetType(System.Web.Services.Protocols.UrlParameterWriter))>  _
    Public Function Add(ByVal num1 As String, ByVal num2 As String) As <System.Xml.Serialization.XmlRootAttribute("int", [Namespace]:="http://www.contoso.com/", IsNullable:=false)> Integer
        Return CType(Me.Invoke("Add", (Me.Url + "/Add"), New Object() {num1, num2}),Integer)
    End Function
    
    <System.Diagnostics.DebuggerStepThroughAttribute()>  _
    Public Function BeginAdd(ByVal num1 As String, ByVal num2 As String, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult
        Return Me.BeginInvoke("Add", (Me.Url + "/Add"), New Object() {num1, num2}, callback, asyncState)
    End Function
    
    <System.Diagnostics.DebuggerStepThroughAttribute()>  _
    Public Function EndAdd(ByVal asyncResult As System.IAsyncResult) As Integer
        Return CType(Me.EndInvoke(asyncResult),Integer)
    End Function
End Class

次の例は、上記のプロキシ クラスが作成された Math XML Web サービスです。

<%@ WebService Language="C#" Class="Math"%>
 using System.Web.Services;
 using System;
 
 public class Math {
      [ WebMethod ]
      public int Add(int num1, int num2) {
          return num1+num2;
          }
 }
<%@ WebService Language="VB" Class="Math"%>
Imports System.Web.Services
Imports System

Public Class Math
    <WebMethod()> _
    Public Function Add(num1 As Integer, num2 As Integer) As Integer
        Return num1 + num2
    End Function 'Add
End Class 'Math

注釈

XML Web サービス クライアントが HTTP-GET プロトコルを使用する場合、パラメーターは URL 内でエンコードされ、応答はプレーン XML で返されます。

ASP.NET を使用して XML Web サービス クライアントを構築する場合は、呼び出す XML Web サービスに対して、WebClientProtocol から間接的または直接派生するプロキシ クラスを作成する必要があります。 XML Web サービス クライアントが HTTP を使用して XML Web サービスを呼び出す場合は、プロキシ クラスを HttpSimpleClientProtocol から派生させます。プロキシ クラスは WebClientProtocol から派生します。

HttpGetClientProtocol HttpPostClientProtocol HttpSimpleClientProtocolから派生し、HTTP-GET プロトコルと HTTP-POST プロトコルをそれぞれ使用して XML Web サービス メソッドを呼び出すサポートを提供します。 SOAP を使用して XML Web サービスを呼び出すクライアントは、 SoapHttpClientProtocolから派生する必要があります。

プロキシ クラスの構築の詳細については、「 XML Web サービス プロキシの作成」を参照してください。

コンストラクター

名前 説明
HttpGetClientProtocol()

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

プロパティ

名前 説明
AllowAutoRedirect

クライアントがサーバーのリダイレクトに自動的に従うかどうかを取得または設定します。

(継承元 HttpWebClientProtocol)
CanRaiseEvents

コンポーネントがイベントを発生できるかどうかを示す値を取得します。

(継承元 Component)
ClientCertificates

クライアント証明書のコレクションを取得します。

(継承元 HttpWebClientProtocol)
ConnectionGroupName

要求の接続グループの名前を取得または設定します。

(継承元 WebClientProtocol)
Container

IContainerを含むComponentを取得します。

(継承元 Component)
CookieContainer

Cookie のコレクションを取得または設定します。

(継承元 HttpWebClientProtocol)
Credentials

XML Web サービス クライアント認証のセキュリティ資格情報を取得または設定します。

(継承元 WebClientProtocol)
DesignMode

Componentが現在デザイン モードであるかどうかを示す値を取得します。

(継承元 Component)
EnableDecompression

この HttpWebClientProtocolに対して展開が有効かどうかを示す値を取得または設定します。

(継承元 HttpWebClientProtocol)
Events

この Componentにアタッチされているイベント ハンドラーの一覧を取得します。

(継承元 Component)
PreAuthenticate

事前認証が有効かどうかを取得または設定します。

(継承元 WebClientProtocol)
Proxy

ファイアウォールを介して XML Web サービス要求を行うプロキシ情報を取得または設定します。

(継承元 HttpWebClientProtocol)
RequestEncoding

Encoding XML Web サービスに対するクライアント要求を行うために使用されます。

(継承元 WebClientProtocol)
Site

ISiteComponentを取得または設定します。

(継承元 Component)
Timeout

XML Web サービス クライアントが同期 XML Web サービス要求への応答が到着するまで待機する時間 (ミリ秒単位) を示します。

(継承元 WebClientProtocol)
UnsafeAuthenticatedConnectionSharing

クライアントが NTLM 認証を使用して XML Web サービスをホストする Web サーバーに接続するときに、接続共有が有効かどうかを示す値を取得または設定します。

(継承元 HttpWebClientProtocol)
Url

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

(継承元 WebClientProtocol)
UseDefaultCredentials

Credentials プロパティを DefaultCredentials プロパティの値に設定するかどうかを示す値を取得または設定します。

(継承元 WebClientProtocol)
UserAgent

各要求で送信されるユーザー エージェント ヘッダーの値を取得または設定します。

(継承元 HttpWebClientProtocol)

メソッド

名前 説明
Abort()

XML Web サービス メソッドへの要求を取り消します。

(継承元 WebClientProtocol)
BeginInvoke(String, String, Object[], AsyncCallback, Object)

XML Web サービスのメソッドの非同期呼び出しを開始します。

(継承元 HttpSimpleClientProtocol)
CancelAsync(Object)

呼び出しが既に完了していない限り、XML Web サービス メソッドへの非同期呼び出しを取り消します。

(継承元 HttpWebClientProtocol)
CreateObjRef(Type)

リモート オブジェクトとの通信に使用されるプロキシの生成に必要なすべての関連情報を含むオブジェクトを作成します。

(継承元 MarshalByRefObject)
Dispose()

Componentによって使用されるすべてのリソースを解放します。

(継承元 Component)
Dispose(Boolean)

Componentによって使用されるアンマネージ リソースを解放し、必要に応じてマネージド リソースを解放します。

(継承元 Component)
EndInvoke(IAsyncResult)

HTTP を使用して XML Web サービス メソッドの非同期呼び出しを完了します。

(継承元 HttpSimpleClientProtocol)
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetLifetimeService()

このインスタンスの有効期間ポリシーを制御する現在の有効期間サービス オブジェクトを取得します。

(継承元 MarshalByRefObject)
GetService(Type)

ComponentまたはそのContainerによって提供されるサービスを表すオブジェクトを返します。

(継承元 Component)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
GetWebRequest(Uri)

指定した URI の WebRequest インスタンスを作成します。

GetWebResponse(WebRequest, IAsyncResult)

XML Web サービス メソッドへの非同期要求からの応答を返します。

(継承元 HttpWebClientProtocol)
GetWebResponse(WebRequest)

XML Web サービス メソッドへの同期要求からの応答を返します。

(継承元 HttpWebClientProtocol)
InitializeLifetimeService()

このインスタンスの有効期間ポリシーを制御する有効期間サービス オブジェクトを取得します。

(継承元 MarshalByRefObject)
Invoke(String, String, Object[])

HTTP を使用して XML Web サービス メソッドを呼び出します。

(継承元 HttpSimpleClientProtocol)
InvokeAsync(String, String, Object[], SendOrPostCallback, Object)

関連付けられた状態を維持しながら、指定したメソッドを非同期的に呼び出します。

(継承元 HttpSimpleClientProtocol)
InvokeAsync(String, String, Object[], SendOrPostCallback)

指定したメソッドを非同期的に呼び出します。

(継承元 HttpSimpleClientProtocol)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
MemberwiseClone(Boolean)

現在の MarshalByRefObject オブジェクトの簡易コピーを作成します。

(継承元 MarshalByRefObject)
ToString()

Stringの名前 (存在する場合) を含むComponentを返します。 このメソッドはオーバーライドしないでください。

(継承元 Component)

イベント

名前 説明
Disposed

コンポーネントが Dispose() メソッドの呼び出しによって破棄されるときに発生します。

(継承元 Component)

適用対象

こちらもご覧ください