HttpMethodAttribute クラス
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
HTTP-GET または HTTP-POST を使用する XML Web サービス クライアントにこの属性を適用し、XML Web サービスに送信されたパラメーターをシリアル化する型、および XML Web サービス メソッドから応答を読み取る型を設定します。 このクラスは継承できません。
public ref class HttpMethodAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method)]
public sealed class HttpMethodAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
public sealed class HttpMethodAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method)>]
type HttpMethodAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
type HttpMethodAttribute = class
inherit Attribute
Public NotInheritable Class HttpMethodAttribute
Inherits Attribute
- 継承
- 属性
次の例は、HTTP-POST を使用して XML Web サービス ユーティリティを呼び出すためのWsdl.exe ユーティリティによって生成されるプロキシ クラスです。 Wsdl.exeは自動的に正しい型 ReturnFormatter を提供し ParameterFormatter、プロキシ クラスの継承を HttpPostClientProtocol指定します。
[System::Xml::Serialization::XmlRootAttribute(Namespace="http://tempuri.org/",IsNullable=true)]
public ref class UserName
{
public:
String^ Name;
String^ Domain;
};
public ref class MyUser: public System::Web::Services::Protocols::HttpPostClientProtocol
{
public:
MyUser()
{
this->Url = "http://www.contoso.com/username.asmx";
}
[System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid,System::Web::Services::Protocols::HtmlFormParameterWriter::typeid)]
UserName^ GetUserName()
{
return (dynamic_cast<UserName^>(this->Invoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array<Object^>(0) )));
}
System::IAsyncResult^ BeginGetUserName( System::AsyncCallback^ callback, Object^ asyncState )
{
return this->BeginInvoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array<Object^>(0), callback, asyncState );
}
UserName^ EndGetUserName( System::IAsyncResult^ asyncResult )
{
return (dynamic_cast<UserName^>(this->EndInvoke( asyncResult )));
}
};
public class MyUser : System.Web.Services.Protocols.HttpPostClientProtocol
{
public MyUser()
{
this.Url = "http://www.contoso.com/username.asmx";
}
[System.Web.Services.Protocols.HttpMethodAttribute(typeof(System.Web.Services.Protocols.XmlReturnReader), typeof(System.Web.Services.Protocols.HtmlFormParameterWriter))]
public UserName GetUserName()
{
return ((UserName)(this.Invoke("GetUserName", (this.Url + "/GetUserName"), new object[0])));
}
public System.IAsyncResult BeginGetUserName(System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("GetUserName", (this.Url + "/GetUserName"), new object[0], callback, asyncState);
}
public UserName EndGetUserName(System.IAsyncResult asyncResult)
{
return ((UserName)(this.EndInvoke(asyncResult)));
}
}
[System.Xml.Serialization.XmlRootAttribute(Namespace = "http://tempuri.org/", IsNullable=true)]
public class UserName
{
public string Name;
public string Domain;
}
Public Class MyUser
Inherits System.Web.Services.Protocols.HttpPostClientProtocol
Public Sub New()
Me.Url = "http://www.contoso.com/username.asmx"
End Sub
<HttpMethodAttribute(GetType(XmlReturnReader), GetType(HtmlFormParameterWriter))> _
Public Function GetUserName() As UserName
Return CType(Me.Invoke("GetUserName", Me.Url + "/GetUserName", New Object(0) {}), UserName)
End Function 'GetUserName
Public Function BeginGetUserName(callback As System.AsyncCallback, asyncState As Object) As System.IAsyncResult
Return Me.BeginInvoke("GetUserName", Me.Url + "/GetUserName", New Object(0) {}, callback, asyncState)
End Function 'BeginGetUserName
Public Function EndGetUserName(asyncResult As System.IAsyncResult) As UserName
Return CType(Me.EndInvoke(asyncResult), UserName)
End Function 'EndGetUserName
End Class
<XmlRootAttribute(Namespace := "http://tempuri.org/", IsNullable := True)> _
Public Class UserName
Public Name As String
Public Domain As String
End Class
XML Web サービス クライアントが HTTP-GET を使用して XML Web サービス メソッドを呼び出す場合は、 ReturnFormatter 次のように XmlReturnReader
設定して ParameterFormatter 設定する UrlParameterWriter
必要があります。 HTTP-POST を使用して XML Web サービスを呼び出す XML Web サービス クライアントは、XmlReturnReader
ParameterFormatter HtmlFormParameterWriter
次に設定ReturnFormatterする必要があります。
Http |
HttpMethodAttribute クラスの新しいインスタンスを初期化します。 |
Http |
HttpMethodAttributeの新しいインスタンスを初期化します。 |
Parameter |
XML Web サービス クライアントから XML Web サービス メソッドへ送信されたパラメーターをシリアル化する、Type を取得または設定します。 |
Return |
XML Web サービス メソッドからの応答を逆シリアル化する Type を取得または設定します。 |
Type |
派生クラスで実装されると、この Attribute の一意の識別子を取得します。 (継承元 Attribute) |
Equals(Object) |
このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。 (継承元 Attribute) |
Get |
このインスタンスのハッシュ コードを返します。 (継承元 Attribute) |
Get |
現在のインスタンスの Type を取得します。 (継承元 Object) |
Is |
派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。 (継承元 Attribute) |
Match(Object) |
派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (継承元 Attribute) |
Memberwise |
現在の Object の簡易コピーを作成します。 (継承元 Object) |
To |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
_Attribute. |
一連の名前を対応する一連のディスパッチ識別子に割り当てます。 (継承元 Attribute) |
_Attribute. |
オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。 (継承元 Attribute) |
_Attribute. |
オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 (継承元 Attribute) |
_Attribute. |
オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。 (継承元 Attribute) |
製品 | バージョン |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |