WebServiceAttribute クラス
アセンブリ: System.Web.Services (system.web.services.dll 内)

<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Interface)> _ Public NotInheritable Class WebServiceAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface)] public sealed class WebServiceAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Interface)] public ref class WebServiceAttribute sealed : public Attribute

WebServiceAttribute は、XML Web サービスを発行および実行するための必須クラスではありません。WebServiceAttribute を使用すると、XML Web サービスに対して、共通言語ランタイム識別子の規則によって制限されない名前を指定できます。この名前は、XML Web サービスのサービスの説明やサービス ヘルプ ページで使用されます。
XML Web サービスは、既定の XML 名前空間を変更してから公開する必要があります。クライアント アプリケーションが XML Web サービスを Web 上の他のサービスと区別できるように、各 XML Web サービスには、サービスを識別する固有の XML 名前空間が必要です。開発中の XML Web サービスには http://tempuri.org/ を使用できますが、発行された XML Web サービスではより永続的な名前空間を使用する必要があります。
XML Web サービスは、制御している XML 名前空間で識別する必要があります。たとえば、会社内のインターネット ドメイン名を XML 名前空間の一部として使用できます。多くの XML Web サービスの XML 名前空間は URL と似ていますが、XML 名前空間は Web 上の実際のリソースを指す必要はありません。XML Web サービスの XML 名前空間は URI です。ASP.NET で作成した XML Web サービスの場合、既定の XML 名前空間は Namespace プロパティを使用して変更できます。

WebServiceAttribute の Description プロパティを "Common Server Variables" に設定し、XML 名前空間を http://www.microsoft.com/japan に設定する例を次に示します。
<%@ WebService Language="VB" Class= "ServerVariables"%> Imports System Imports System.Web.Services <WebService(Description := "Common Server Variables", _ Namespace := "http://www.contoso.com/")> _ Public Class ServerVariables Inherits WebService <WebMethod(Description := "Obtains the Computer Machine Name", _ EnableSession := False)> _ Public Function GetMachineName() As String Return Server.MachineName End Function End Class
<%@ WebService Language="C#" Class= "ServerVariables"%> using System; using System.Web.Services; [ WebService(Description="Common Server Variables",Namespace="http://www.contoso.com/")] public class ServerVariables: WebService { [ WebMethod(Description="Obtains the Server Computer Name",EnableSession=false)] public string GetMachineName() { return Server.MachineName; } }

System.Attribute
System.Web.Services.WebServiceAttribute


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebServiceAttribute コンストラクタ
アセンブリ: System.Web.Services (system.web.services.dll 内)


<%@ WebService Language="VB" class= "ServerVariables"%> Imports System Imports System.Web.Services Imports System.Web.Services.Protocols <WebService(Namespace := "http://www.contoso.com/")> _ Public Class ServerVariables Inherits WebService <WebMethod(Description := "Returns the time as stored on the Server", _ EnableSession := False)> _ Public Function Time() As String Return Context.Timestamp.TimeOfDay.ToString() End Function End Class
<%@ WebService Language="C#" class= "ServerVariables"%> using System; using System.Web.Services; using System.Web.Services.Protocols; [ WebService(Namespace="http://www.contoso.com/")] public class ServerVariables: WebService { [ WebMethod(Description="Returns the time as stored on the Server" ,EnableSession=false)] public string Time() { return Context.Timestamp.TimeOfDay.ToString(); } }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebServiceAttribute フィールド


関連項目
WebServiceAttribute クラスSystem.Web.Services 名前空間
WebService クラス
WebMethodAttribute クラス
SoapDocumentMethodAttribute
SoapDocumentServiceAttribute
SoapRpcMethodAttribute
SoapRpcServiceAttribute
WebServiceAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | Description | XML Web サービスの説明メッセージ。 |
![]() | Name | XML Web サービスの名前を取得または設定します。 |
![]() | Namespace | XML Web サービスで使用する既定の XML 名前空間を取得または設定します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |

関連項目
WebServiceAttribute クラスSystem.Web.Services 名前空間
WebService クラス
WebMethodAttribute クラス
SoapDocumentMethodAttribute
SoapDocumentServiceAttribute
SoapRpcMethodAttribute
SoapRpcServiceAttribute
WebServiceAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

関連項目
WebServiceAttribute クラスSystem.Web.Services 名前空間
WebService クラス
WebMethodAttribute クラス
SoapDocumentMethodAttribute
SoapDocumentServiceAttribute
SoapRpcMethodAttribute
SoapRpcServiceAttribute
WebServiceAttribute メンバ
XML Web サービスに追加情報 (機能を説明する文字列など) を追加するために使用します。
WebServiceAttribute データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | Description | XML Web サービスの説明メッセージ。 |
![]() | Name | XML Web サービスの名前を取得または設定します。 |
![]() | Namespace | XML Web サービスで使用する既定の XML 名前空間を取得または設定します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

関連項目
WebServiceAttribute クラスSystem.Web.Services 名前空間
WebService クラス
WebMethodAttribute クラス
SoapDocumentMethodAttribute
SoapDocumentServiceAttribute
SoapRpcMethodAttribute
SoapRpcServiceAttribute
Weblioに収録されているすべての辞書からWebServiceAttributeを検索する場合は、下記のリンクをクリックしてください。

- WebServiceAttributeのページへのリンク