WebServiceAttribute クラスとは? わかりやすく解説

WebServiceAttribute クラス

XML Web サービス追加情報 (機能説明する文字列など) を追加するために使用します

名前空間: System.Web.Services
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Interface)>
 _
Public NotInheritable Class
 WebServiceAttribute
    Inherits Attribute
Dim instance As WebServiceAttribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface)] 
public sealed class WebServiceAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Interface)] 
public ref class WebServiceAttribute sealed
 : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface)
 */ 
public final class WebServiceAttribute extends
 Attribute
AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface) 
public final class WebServiceAttribute extends
 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 プロパティ使用して変更できます

属性使用方法については、「属性使用したメタデータ拡張」を参照してください

使用例使用例

WebServiceAttributeDescription プロパティを "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.Object
   System.Attribute
    System.Web.Services.WebServiceAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebServiceAttribute メンバ
System.Web.Services 名前空間
WebService クラス
WebMethodAttribute クラス
SoapDocumentMethodAttribute
SoapDocumentServiceAttribute
SoapRpcMethodAttribute
SoapRpcServiceAttribute



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「WebServiceAttribute クラス」の関連用語

WebServiceAttribute クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebServiceAttribute クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS