HttpSimpleClientProtocol クラス

定義

単純な HTTP-GET プロトコル バインディングおよび HTTP-POST プロトコル バインディングを使用して、XML Web サービスとの通信を行う基本クラスを表します。

public ref class HttpSimpleClientProtocol abstract : System::Web::Services::Protocols::HttpWebClientProtocol
public abstract class HttpSimpleClientProtocol : System.Web.Services.Protocols.HttpWebClientProtocol
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class HttpSimpleClientProtocol : System.Web.Services.Protocols.HttpWebClientProtocol
type HttpSimpleClientProtocol = class
    inherit HttpWebClientProtocol
[<System.Runtime.InteropServices.ComVisible(true)>]
type HttpSimpleClientProtocol = class
    inherit HttpWebClientProtocol
Public MustInherit Class HttpSimpleClientProtocol
Inherits HttpWebClientProtocol
継承
派生
属性

次のコード例は、以下の XML Web サービスの Math 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 サービスです。

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

using namespace System::Web::Services;
using namespace System;
public ref class Math
{
public:

   [WebMethod]
   int Add( int num1, int num2 )
   {
      return num1 + num2;
   }

};

using System.Web.Services;
using System;

public class Math
{
    [WebMethod]
    public int Add(int num1, int num2)
    {
        return num1 + num2;
    }
}
Imports System.Web.Services

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

注釈

このクラスは、エンコーダーを使用してパラメーターをエンコードし、値を一般的な MIME 形式に戻すために、HTTP 経由で XML Web サービスと通信するための実装の大部分を指定します。 これらのエンコーダーは、 クラスから MimeFormatter 派生します。 既定では、 から HttpSimpleClientProtocol 派生したプロキシ クラスは、application/x-www-form-urlencoded MIME の種類とプレーン XML での応答を使用してパラメーターをエンコードします。 カスタム MIME フォーマッタは 属性を HttpMethodAttribute 使用して指定できますが、これをサービスの説明とプロキシ生成に統合することはサポートされません。

Notes to Inheritors: このクラスをオーバーライドすると、XML Web サービスの特定の型に固有のメソッドを派生クラスに導入できます。 メソッドは単にパラメーターをキャプチャし、基本クラスを呼び出してサイトと通信する作業を行います。 導入されたメソッドが非同期の場合は、 メソッドと EndInvoke メソッドをBeginInvoke呼び出します。 導入されたメソッドが同期的な場合は、 メソッドを呼び出します Invoke 。 オーバーライドされたコンストラクターは、通常、 プロパティを Url XML Web サービス メソッドの URI に設定します。

Web サービス記述言語ツール (Wsdl.exe) は、特定のサービスの説明に対して の HttpSimpleClientProtocol 派生クラスを生成します。

コンストラクター

HttpSimpleClientProtocol()

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

プロパティ

AllowAutoRedirect

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

(継承元 HttpWebClientProtocol)
CanRaiseEvents

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

(継承元 Component)
ClientCertificates

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

(継承元 HttpWebClientProtocol)
ConnectionGroupName

要求に対して使用する接続グループの名前を取得または設定します。

(継承元 WebClientProtocol)
Container

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

(継承元 Component)
CookieContainer

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

(継承元 HttpWebClientProtocol)
Credentials

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

(継承元 WebClientProtocol)
DesignMode

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

(継承元 Component)
EnableDecompression

この HttpWebClientProtocol の圧縮解除が有効かどうかを示す値を取得または設定します。

(継承元 HttpWebClientProtocol)
Events

Component に結び付けられているイベント ハンドラーのリストを取得します。

(継承元 Component)
PreAuthenticate

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

(継承元 WebClientProtocol)
Proxy

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

(継承元 HttpWebClientProtocol)
RequestEncoding

クライアントが XML Web サービスを要求するときに使用される Encoding

(継承元 WebClientProtocol)
Site

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

(継承元 Component)
Timeout

同期的な XML Web サービスの要求に対する返答の受信を XML Web サービス クライアントが待機する時間 (ミリ秒単位) を示します。

(継承元 WebClientProtocol)
UnsafeAuthenticatedConnectionSharing

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

(継承元 HttpWebClientProtocol)
Url

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

(継承元 WebClientProtocol)
UseDefaultCredentials

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

(継承元 WebClientProtocol)
UserAgent

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

(継承元 HttpWebClientProtocol)

メソッド

Abort()

XML Web サービス メソッドへの要求をキャンセルします。

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

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

CancelAsync(Object)

呼び出しが完了済みの場合を除き、XML Web サービス メソッドの非同期呼び出しをキャンセルします。

(継承元 HttpWebClientProtocol)
CreateObjRef(Type)

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

(継承元 MarshalByRefObject)
Dispose()

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

(継承元 Component)
Dispose(Boolean)

Component によって使用されているアンマネージド リソースを解放し、オプションでマネージド リソースも解放します。

(継承元 Component)
EndInvoke(IAsyncResult)

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

Equals(Object)

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

(継承元 Object)
GetHashCode()

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

(継承元 Object)
GetLifetimeService()
古い.

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

(継承元 MarshalByRefObject)
GetService(Type)

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

(継承元 Component)
GetType()

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

(継承元 Object)
GetWebRequest(Uri)

指定した URI に対する WebRequest を作成します。

(継承元 HttpWebClientProtocol)
GetWebResponse(WebRequest)

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

(継承元 HttpWebClientProtocol)
GetWebResponse(WebRequest, IAsyncResult)

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

(継承元 HttpWebClientProtocol)
InitializeLifetimeService()
古い.

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

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

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

InvokeAsync(String, String, Object[], SendOrPostCallback)

指定されたメソッドを非同期で呼び出します。

InvokeAsync(String, String, Object[], SendOrPostCallback, Object)

関連付けられている状態を保持したまま、指定されたメソッドを非同期で呼び出します。

MemberwiseClone()

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

(継承元 Object)
MemberwiseClone(Boolean)

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

(継承元 MarshalByRefObject)
ToString()

Component の名前 (存在する場合) を格納する String を返します。 このメソッドはオーバーライドできません。

(継承元 Component)

イベント

Disposed

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

(継承元 Component)

適用対象

スレッド セーフ

この型はスレッド セーフです。

こちらもご覧ください