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

SoapMethodAttribute クラス

メソッドSOAP 生成および SOAP 処理をカスタマイズます。このクラス継承できません。

名前空間: System.Runtime.Remoting.Metadata
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Method)> _
<ComVisibleAttribute(True)> _
Public NotInheritable Class
 SoapMethodAttribute
    Inherits SoapAttribute
Dim instance As SoapMethodAttribute
[AttributeUsageAttribute(AttributeTargets.Method)] 
[ComVisibleAttribute(true)] 
public sealed class SoapMethodAttribute : SoapAttribute
[AttributeUsageAttribute(AttributeTargets::Method)] 
[ComVisibleAttribute(true)] 
public ref class SoapMethodAttribute sealed
 : public SoapAttribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Method) */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class SoapMethodAttribute extends
 SoapAttribute
AttributeUsageAttribute(AttributeTargets.Method) 
ComVisibleAttribute(true) 
public final class SoapMethodAttribute extends
 SoapAttribute
解説解説

SoapMethodAttribute 属性ターゲット オブジェクトは、リモートから呼び出すことができるメソッドです。SOAP 生成および SOAP 処理をカスタマイズするために SoapMethodAttribute適用します。この属性プロパティ使用すると、プログラマは SOAPAction HTTP ヘッダー フィールドカスタマイズして、SOAP HTTP 要求意図を示すことができます

使用例使用例

SoapMethodAttribute クラスメンバ使用してメソッドSOAP 生成と処理をカスタマイズする方法次のコード例示します

using System;
using System.Runtime.Remoting.Metadata;
using System.Security.Permissions;

namespace ExampleNamespace
{
    public class ExampleClass
    {
        [SoapMethod(
             ResponseXmlElementName="ExampleResponseElement",
             ResponseXmlNamespace=
                "http://example.org/MethodResponseXmlNamespace"
,
             ReturnXmlElementName="HelloMessage",
             SoapAction="http://example.org/ExampleSoapAction#GetHello"
,
             XmlNamespace="http://example.org/MethodCallXmlNamespace")]
        public string GetHello(string
 name)
        {
            return "Hello, " + name;
        }
    }
}

public class Demo
{
[SecurityPermission(SecurityAction.Demand)]
    public static void Main(string[]
 args)
    {
        // Get the method info object for the GetHello method.
        System.Reflection.MethodBase getHelloMethod = 
            typeof(ExampleNamespace.ExampleClass).GetMethod("GetHello");

        // Print the XML namespace for the invocation of this method.
        string methodCallXmlNamespace = 
            System.Runtime.Remoting.SoapServices.
                GetXmlNamespaceForMethodCall(getHelloMethod);
        Console.WriteLine(
            "The XML namespace for the
 response of the method " +
            "GetHello in ExampleClass is {0}.",
            methodCallXmlNamespace);

        // Print the XML namespace for the response of this method.
        string methodResponseXmlNamespace =
            System.Runtime.Remoting.SoapServices.
                GetXmlNamespaceForMethodResponse(getHelloMethod);
        Console.WriteLine(
            "The XML namespace for the
 invocation of the method " +
            "GetHello in ExampleClass is {0}.",
            methodResponseXmlNamespace);

        // Print the SOAP action for this method.
        string getHelloSoapAction =
            System.Runtime.Remoting.SoapServices.
                GetSoapActionFromMethodBase(getHelloMethod);
        Console.WriteLine(
            "The SOAP action for the method " +
            "GetHello in ExampleClass is {0}.", 
            getHelloSoapAction);
    }
}
#using <System.dll>
#using <System.Runtime.Remoting.dll>
using namespace System;
using namespace System::Runtime::Remoting::Metadata;

namespace ExampleNamespace
{
   public ref class ExampleClass
   {
   public:
      [SoapMethod(
         ResponseXmlElementName="ExampleResponseElement",
         ResponseXmlNamespace=
         "http://example.org/MethodResponseXmlNamespace",
         ReturnXmlElementName="HelloMessage",
         SoapAction="http://example.org/ExampleSoapAction#GetHello"
,
         XmlNamespace="http://example.org/MethodCallXmlNamespace")]
      String^ GetHello( String^ name )
      {
         return String::Format( L"Hello, {0}", name
 );
      }
   };

}

int main()
{
   
   // Get the method info object for the GetHello method.
   System::Reflection::MethodBase^ getHelloMethod = 
      ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello"
 );
   
   // Print the XML namespace for the invocation of this method.
   String^ methodCallXmlNamespace =
      System::Runtime::Remoting::SoapServices::GetXmlNamespaceForMethodCall(
         getHelloMethod );
   Console::WriteLine( L"The XML namespace for
 the response of the method "
         L"GetHello in ExampleClass is {0}.", methodCallXmlNamespace
 );
   
   // Print the XML namespace for the response of this method.
   String^ methodResponseXmlNamespace =
      System::Runtime::Remoting::SoapServices::GetXmlNamespaceForMethodCall(
         getHelloMethod );
   Console::WriteLine( L"The XML namespace for
 the invocation of the method "
         L"GetHello in ExampleClass is {0}.", methodResponseXmlNamespace
 );
   
   // Print the SOAP action for this method.
   String^ getHelloSoapAction =
      System::Runtime::Remoting::SoapServices::GetXmlNamespaceForMethodCall(
         getHelloMethod );
   Console::WriteLine( L"The SOAP action for the method "
         L"GetHello in ExampleClass is {0}.", getHelloSoapAction
 );
}
継承階層継承階層
System.Object
   System.Attribute
     System.Runtime.Remoting.Metadata.SoapAttribute
      System.Runtime.Remoting.Metadata.SoapMethodAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SoapMethodAttribute メンバ
System.Runtime.Remoting.Metadata 名前空間



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

辞書ショートカット

すべての辞書の索引

「SoapMethodAttribute クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS