HttpPostClientProtocol クラス

定義

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

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

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

#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::HttpPostClientProtocol
{
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::HtmlFormParameterWriter::typeid)]
   [returnvalue:System::Xml::Serialization::XmlRootAttribute("snippet1>",Namespace="http://www.contoso.com/",IsNullable=false)]
   int Add( String^ num1, String^ num2 )
   {
      array<Object^>^temp2 = {num1,num2};
      return  *dynamic_cast<int^>(this->Invoke( "Add", (String::Concat( this->Url, "/Add" )), temp2 ));
   }

   [System::Diagnostics::DebuggerStepThroughAttribute]
   System::IAsyncResult^ BeginAdd( String^ num1, String^ num2, System::AsyncCallback^ callback, Object^ asyncState )
   {
      array<Object^>^temp3 = {num1,num2};
      return this->BeginInvoke( "Add", (this->Url + "/Add" ), temp3, 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.HttpPostClientProtocol
{
    [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.HtmlFormParameterWriter))]
    [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.HttpPostClientProtocol
    
    <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.HtmlFormParameterWriter))>  _
    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-POST プロトコルを使用する場合、既定では、URL エンコード 規則を使用して HTTP 本文内でパラメーターがエンコードされ、応答にプレーン XML が使用されます。 このプロトコルは、パラメーターをエンコードし、値を標準 MIME 形式に戻すために派生 MimeFormatter するクラスを使用します。 使用するエンコーダーは、サービスの説明で指定します。

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

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

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

コンストラクター

HttpPostClientProtocol()

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

プロパティ

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 サービスのメソッドの非同期呼び出しを開始します。

(継承元 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)

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

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

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

(継承元 HttpWebClientProtocol)
InitializeLifetimeService()
互換性のために残されています。

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

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

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

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

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

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

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

(継承元 HttpSimpleClientProtocol)
MemberwiseClone()

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

(継承元 Object)
MemberwiseClone(Boolean)

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

(継承元 MarshalByRefObject)
ToString()

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

(継承元 Component)

events

Disposed

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

(継承元 Component)

適用対象

こちらもご覧ください