派生クラスでオーバーライドされると、SOAP 拡張機能を XML Web サービス メソッドと共に実行するように指定します。
この型のすべてのメンバの一覧については、SoapExtensionAttribute メンバ を参照してください。
System.Object
System.Attribute
System.Web.Services.Protocols.SoapExtensionAttribute
MustInherit Public Class SoapExtensionAttribute
Inherits Attribute
[C#]
public abstract class SoapExtensionAttribute : Attribute
[C++]
public __gc __abstract class SoapExtensionAttribute : public
Attribute
[JScript]
public abstract class SoapExtensionAttribute extends Attribute
スレッドセーフ
この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。
解説
ASP.NET で作成された XML Web サービス メソッドに属性を適用して、その XML Web サービス メソッドが SOAP 拡張機能と共に実行されるように設定できます。カスタム拡張機能属性を XML Web サービス メソッドまたはプロキシ クラス クライアントのメソッドに追加すると、ASP.NET は関連する拡張機能を適切なときに呼び出します。拡張機能属性は、 SoapExtensionAttribute から派生するカスタム属性クラスです。派生した属性は、 ExtensionType プロパティをオーバーライドして、属性と関連付けられている拡張機能の型を返す必要があります。
使用例
[Visual Basic, C#, C++] SoapExtensionAttribute から派生した次の TraceExtensionAttribute
クラスは、XML Web サービス メソッドまたは XML Web サービス クライアント プロキシ クラスのメソッドへの属性の適用をサポートします。XML Web サービス メソッドまたは XML Web サービス クライアント プロキシ クラスのメソッドへ属性が適用されると、 TraceExtension
SOAP 拡張機能がそのメソッドと共に実行されます。
' Create a SoapExtensionAttribute for a SOAP extension that can be
' applied to an XML Web service method.
<AttributeUsage(AttributeTargets.Method)> _
Public Class TraceExtensionAttribute
Inherits SoapExtensionAttribute
Private m_filename As String = "c:\log.txt"
Private m_priority As Integer
' Return the type of 'TraceExtension' class.
Public Overrides ReadOnly Property ExtensionType() As Type
Get
Return GetType(TraceExtension)
End Get
End Property
' User can set priority of the 'TraceExtension'.
Public Overrides Property Priority() As Integer
Get
Return m_priority
End Get
Set(ByVal Value As Integer)
m_priority = value
End Set
End Property
Public Property Filename() As String
Get
Return m_filename
End Get
Set(ByVal Value As String)
m_filename = value
End Set
End Property
End Class
[C#]
// Create a SoapExtensionAttribute for a SOAP extension that can be
// applied to an XML Web service method.
[AttributeUsage(AttributeTargets.Method)]
public class TraceExtensionAttribute : SoapExtensionAttribute {
private string myFilename;
private int myPriority;
// Set the name of the log file were SOAP messages will be stored.
public TraceExtensionAttribute() : base()
{
myFilename = "C:\\logClient.txt";
}
// Return the type of 'TraceExtension' class.
public override Type ExtensionType
{
get
{
return typeof(TraceExtension);
}
}
// User can set priority of the 'SoapExtension'.
public override int Priority
{
get
{
return myPriority;
}
set
{
myPriority = value;
}
}
public string Filename
{
get
{
return myFilename;
}
set
{
myFilename = value;
}
}
}
[C++]
// Create a SoapExtensionAttribute for a SOAP extension that can be
// applied to an XML Web service method.
[AttributeUsage(AttributeTargets::Method)]
public __gc class TraceExtensionAttribute : public SoapExtensionAttribute {
private:
String* myFilename;
int myPriority;
// Set the name of the log file were SOAP messages will be stored.
public:
TraceExtensionAttribute() : SoapExtensionAttribute()
{
myFilename = S"C:\\logClient.txt";
}
// Return the type of 'TraceExtension' class.
__property Type* get_ExtensionType()
{
return __typeof(TraceExtension);
}
// User can set priority of the 'SoapExtension'.
__property int get_Priority()
{
return myPriority;
}
__property void set_Priority( int value )
{
myPriority = value;
}
__property String* get_Filename()
{
return myFilename;
}
__property void set_Filename( String* value )
{
myFilename = value;
}
};
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System.Web.Services.Protocols
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
アセンブリ: System.Web.Services (System.Web.Services.dll 内)
参照
SoapExtensionAttribute メンバ | System.Web.Services.Protocols 名前空間 | SoapExtension | SoapMessage