HttpGetClientProtocol クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
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
- 継承
-
HttpGetClientProtocol
例
次の例は、 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 | (継承元 Component) |
| Timeout |
XML Web サービス クライアントが同期 XML Web サービス要求への応答が到着するまで待機する時間 (ミリ秒単位) を示します。 (継承元 WebClientProtocol) |
| UnsafeAuthenticatedConnectionSharing |
クライアントが NTLM 認証を使用して XML Web サービスをホストする Web サーバーに接続するときに、接続共有が有効かどうかを示す値を取得または設定します。 (継承元 HttpWebClientProtocol) |
| Url |
クライアントが要求している XML Web サービスのベース URL を取得または設定します。 (継承元 WebClientProtocol) |
| UseDefaultCredentials |
Credentials プロパティを DefaultCredentials プロパティの値に設定するかどうかを示す値を取得または設定します。 (継承元 WebClientProtocol) |
| UserAgent |
各要求で送信されるユーザー エージェント ヘッダーの値を取得または設定します。 (継承元 HttpWebClientProtocol) |
メソッド
イベント
| 名前 | 説明 |
|---|---|
| Disposed |
コンポーネントが Dispose() メソッドの呼び出しによって破棄されるときに発生します。 (継承元 Component) |