SoapHttpClientProtocol クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
SOAP の使用時にプロキシの派生元となるクラス クライアントを指定します。
public ref class SoapHttpClientProtocol : System::Web::Services::Protocols::HttpWebClientProtocol
public class SoapHttpClientProtocol : System.Web.Services.Protocols.HttpWebClientProtocol
[System.Runtime.InteropServices.ComVisible(true)]
public class SoapHttpClientProtocol : System.Web.Services.Protocols.HttpWebClientProtocol
type SoapHttpClientProtocol = class
inherit HttpWebClientProtocol
[<System.Runtime.InteropServices.ComVisible(true)>]
type SoapHttpClientProtocol = class
inherit HttpWebClientProtocol
Public Class SoapHttpClientProtocol
Inherits HttpWebClientProtocol
- 継承
- 属性
例
次のコード例は、 Math XML Web サービスの Wsdl.exe によって生成されるプロキシ クラスです。 プロキシ クラスは、抽象SoapHttpClientProtocol クラスから派生するWebClientProtocolから派生します。
#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;
namespace MyMath
{
[System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap",Namespace="http://www.contoso.com/")]
public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol
{
public:
[System::Diagnostics::DebuggerStepThroughAttribute]
MyMath()
{
this->Url = "http://www.contoso.com/math.asmx";
}
[System::Diagnostics::DebuggerStepThroughAttribute]
[System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://www.contoso.com/Add",
RequestNamespace="http://www.contoso.com/",ResponseNamespace="http://www.contoso.com/",
Use=System::Web::Services::Description::SoapBindingUse::Literal,
ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)]
int Add( int num1, int num2 )
{
array<Object^>^temp0 = {num1,num2};
array<Object^>^results = this->Invoke( "Add", temp0 );
return *dynamic_cast<int^>(results[ 0 ]);
}
[System::Diagnostics::DebuggerStepThroughAttribute]
System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState )
{
array<Object^>^temp1 = {num1,num2};
return this->BeginInvoke( "Add", temp1, callback, asyncState );
}
[System::Diagnostics::DebuggerStepThroughAttribute]
int EndAdd( System::IAsyncResult^ asyncResult )
{
array<Object^>^results = this->EndInvoke( asyncResult );
return *dynamic_cast<int^>(results[ 0 ]);
}
};
}
namespace MyMath {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(Name="MyMathSoap", Namespace="http://www.contoso.com/")]
public class MyMath : System.Web.Services.Protocols.SoapHttpClientProtocol {
[System.Diagnostics.DebuggerStepThroughAttribute()]
public MyMath() {
this.Url = "http://www.contoso.com/math.asmx";
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.contoso.com/Add", RequestNamespace="http://www.contoso.com/", ResponseNamespace="http://www.contoso.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int Add(int num1, int num2) {
object[] results = this.Invoke("Add", new object[] {num1,
num2});
return ((int)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.IAsyncResult BeginAdd(int num1, int num2, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("Add", new object[] {num1,
num2}, callback, asyncState);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public int EndAdd(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
}
Option Strict On
Option Explicit On
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
Namespace MyMath
<System.Web.Services.WebServiceBindingAttribute(Name:="MyMathSoap", [Namespace]:="http://www.contoso.com/")> _
Public Class MyMath
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
<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.SoapDocumentMethodAttribute("http://www.contoso.com/Add", RequestNamespace:="http://www.contoso.com/", ResponseNamespace:="http://www.contoso.com/", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
Public Function Add(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Dim results() As Object = Me.Invoke("Add", New Object() {num1, num2})
Return CType(results(0),Integer)
End Function
<System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Function BeginAdd(ByVal num1 As Integer, ByVal num2 As Integer, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult
Return Me.BeginInvoke("Add", New Object() {num1, num2}, callback, asyncState)
End Function
<System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Function EndAdd(ByVal asyncResult As System.IAsyncResult) As Integer
Dim results() As Object = Me.EndInvoke(asyncResult)
Return CType(results(0),Integer)
End Function
End Class
End Namespace
次のコード例は、上記のプロキシ クラスが生成された Math XML Web サービスです。
Important
この例には、潜在的なセキュリティ上の脅威であるユーザー入力を受け入れるテキスト ボックスがあります。 既定では、ASP.NET Web ページでは、ユーザー入力にスクリプトや HTML 要素が含まれていないことが検証されます。 詳細については、「スクリプトの 悪用の概要」を参照してください。
<%@ WebService Language="C#" Class="MyMath"%>
using System.Web.Services;
using System;
[WebService(Namespace="http://www.contoso.com/")]
public class MyMath {
[ WebMethod ]
public int Add(int num1, int num2) {
return num1+num2;
}
}
<%@ WebService Language="VB" Class="MyMath"%>
Imports System.Web.Services
Imports System
<WebService(Namespace:="http://www.contoso.com/")> _
Public Class MyMath
<WebMethod()> _
Public Function Add(num1 As Integer, num2 As Integer) As Integer
Return num1 + num2
End Function 'Add
End Class 'Math
注釈
XML Web サービス クライアントを構築する場合は、から間接的または直接派生するプロキシ クラスを XML Web サービス用に作成する必要があります。 XML Web サービス クライアントが SOAP を使用して呼び出す場合、プロキシ クラスは、HttpWebClientProtocolから派生するSoapHttpClientProtocolから派生する必要があります。 HttpWebClientProtocol次に、 WebClientProtocolから派生します。
XML Web サービスと通信するには、呼び出す XML Web サービスの WebClientProtocol から間接的または直接派生するプロキシ クラスを作成します。 プロキシ クラスを手動で作成する代わりに、Web サービス記述言語ツール (Wsdl.exe) を使用して、特定の XML Web サービスのサービス記述のプロキシ クラスを作成します。 SOAP プロトコルに対してプロキシ クラスが生成されると、XML Web サービス メソッドへの同期呼び出しは Invoke メソッドを介して行われますが、非同期呼び出しは BeginInvoke メソッドと EndInvoke メソッドを使用して行われます。
注意 (継承者)
このクラスをオーバーライドすると、特定の種類の XML Web サービスに固有のメソッドを派生クラスに導入できます。 メソッドはパラメーターをキャプチャし、基本クラスを呼び出して XML Web サービスと通信する処理を行います。 導入されたメソッドが非同期の場合は、 BeginInvoke(String, Object[], AsyncCallback, Object) メソッドと EndInvoke(IAsyncResult) メソッドを呼び出します。 導入されたメソッドが同期的な場合は、 Invoke(String, Object[]) メソッドを呼び出します。 オーバーライドされたコンストラクターは、通常、 Url プロパティを XML Web サービス メソッドの URL に設定します。
コンストラクター
| 名前 | 説明 |
|---|---|
| SoapHttpClientProtocol() |
SoapHttpClientProtocol クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| 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) |
| SoapVersion |
XML Web サービスへの SOAP 要求を行うために使用する SOAP プロトコルのバージョンを取得または設定します。 |
| 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, Object[], AsyncCallback, Object) |
SOAP を使用して XML Web サービス メソッドの非同期呼び出しを開始します。 |
| CancelAsync(Object) |
呼び出しが既に完了していない限り、XML Web サービス メソッドへの非同期呼び出しを取り消します。 (継承元 HttpWebClientProtocol) |
| CreateObjRef(Type) |
リモート オブジェクトとの通信に使用されるプロキシの生成に必要なすべての関連情報を含むオブジェクトを作成します。 (継承元 MarshalByRefObject) |
| Discover() |
Urlの探索ドキュメントで説明されている XML Web サービスに動的にバインドします。 |
| Dispose() |
Componentによって使用されるすべてのリソースを解放します。 (継承元 Component) |
| Dispose(Boolean) |
Componentによって使用されるアンマネージ リソースを解放し、必要に応じてマネージド リソースを解放します。 (継承元 Component) |
| EndInvoke(IAsyncResult) |
SOAP を使用して XML Web サービス メソッドの非同期呼び出しを終了します。 |
| Equals(Object) |
指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetLifetimeService() |
このインスタンスの有効期間ポリシーを制御する現在の有効期間サービス オブジェクトを取得します。 (継承元 MarshalByRefObject) |
| GetReaderForMessage(SoapClientMessage, Int32) |
SoapClientMessage パラメーターのStream プロパティで初期化されたXmlReaderを返します。 |
| GetService(Type) |
ComponentまたはそのContainerによって提供されるサービスを表すオブジェクトを返します。 (継承元 Component) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| GetWebRequest(Uri) |
指定したWebRequestの |
| GetWebResponse(WebRequest, IAsyncResult) |
XML Web サービス メソッドへの非同期要求からの応答を返します。 (継承元 HttpWebClientProtocol) |
| GetWebResponse(WebRequest) |
XML Web サービス メソッドへの同期要求からの応答を返します。 (継承元 HttpWebClientProtocol) |
| GetWriterForMessage(SoapClientMessage, Int32) |
SoapClientMessage パラメーターのStream プロパティで初期化されたXmlWriterを返します。 |
| InitializeLifetimeService() |
このインスタンスの有効期間ポリシーを制御する有効期間サービス オブジェクトを取得します。 (継承元 MarshalByRefObject) |
| Invoke(String, Object[]) |
SOAP を使用して XML Web サービス メソッドを同期的に呼び出します。 |
| InvokeAsync(String, Object[], SendOrPostCallback, Object) |
指定したメソッドを非同期的に呼び出します。 |
| InvokeAsync(String, Object[], SendOrPostCallback) |
指定したメソッドを非同期的に呼び出します。 |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| MemberwiseClone(Boolean) |
現在の MarshalByRefObject オブジェクトの簡易コピーを作成します。 (継承元 MarshalByRefObject) |
| ToString() |
Stringの名前 (存在する場合) を含むComponentを返します。 このメソッドはオーバーライドしないでください。 (継承元 Component) |
イベント
| 名前 | 説明 |
|---|---|
| Disposed |
コンポーネントが Dispose() メソッドの呼び出しによって破棄されるときに発生します。 (継承元 Component) |
適用対象
スレッド セーフ
この型はスレッド セーフです。