SoapRpcMethodAttribute クラス

定義

メソッドとやり取りされる SOAP メッセージの書式として RPC スタイルを使用することを指定します。

public ref class SoapRpcMethodAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method)]
public sealed class SoapRpcMethodAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
public sealed class SoapRpcMethodAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method)>]
type SoapRpcMethodAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
type SoapRpcMethodAttribute = class
    inherit Attribute
Public NotInheritable Class SoapRpcMethodAttribute
Inherits Attribute
継承
SoapRpcMethodAttribute
属性

次のコード例では、XML Web サービス メソッドのメッセージ スタイル RpcGetUserName 設定します。

<%@ WebService Language="C#" class="MyUser" %>
 using System;
 using System.Web.Services;
 using System.Web.Services.Protocols;
 
 public class MyUser : WebService {
 
       [ SoapRpcMethod(Action="http://www.contoso.com/Sample", 
           RequestNamespace="http://www.contoso.com/Request",
           RequestElementName="GetUserNameRequest",
           ResponseNamespace="http://www.contoso.com/Response",
           ResponseElementName="GetUserNameResponse")]
      [ WebMethod(Description="Obtains the User Name") ]
      public UserName GetUserName() {
           string temp;
           int pos;
           UserName NewUser = new UserName();
           
           // Get the full user name, including the domain name if applicable.
           temp = User.Identity.Name;
 
           // Determine whether the user is part of a domain by searching for a backslash.
           pos = temp.IndexOf("\\");
           
           // Parse out the domain name from the string, if one exists.
           if (pos <= 0)
                 NewUser.Name = User.Identity.Name;
           else {
               NewUser.Name = temp.Remove(0,pos+1);
                 NewUser.Domain = temp.Remove(pos,temp.Length-pos);
           } 
       return NewUser;
      }
 
 }   
 
 public class UserName {
 
     public string Name;
     public string Domain;
 }
<%@ WebService Language="VB" class="MyUser" %>
Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols

Public Class MyUser
    Inherits WebService    
    
    <SoapRpcMethod(Action := "http://www.contoso.com/Sample", _
    RequestNamespace := "http://www.contoso.com/Request", _
    RequestElementName := "GetUserNameRequest", _
    ResponseNamespace := "http://www.contoso.com/Response", _
    ResponseElementName := "GetUserNameResponse"), _
    WebMethod(Description := "Obtains the User Name")> _
    Public Function _
        GetUserName() As UserName
        
        Dim temp As String
        Dim pos As Integer
        Dim NewUser As New UserName()
        
        ' Get the full user name, including the domain name if applicable.
        temp = User.Identity.Name
        
        ' Determine whether the user is part of a domain by searching for a backslash.
        pos = temp.IndexOf("\")
        
        ' Parse out the domain name from the string, if one exists.
        If pos <= 0 Then
            NewUser.Name = User.Identity.Name
        Else
            NewUser.Name = temp.Remove(0, pos + 1)
            NewUser.Domain = temp.Remove(pos, temp.Length - pos)
        End If
        Return NewUser
    End Function
End Class 

Public Class UserName
    
    Public Name As String
    Public Domain As String
End Class

注釈

Web サービス記述言語 (WSDL) では、XML Web サービス メソッド (または操作) を SOAP メッセージ RPC Documentで書式設定する方法と、次の 2 つのスタイルを定義します。 RPC 書式設定とは、SOAP for RPC を使用するための SOAP 仕様に従って操作を書式設定することを指します。それ以外の場合は SOAP 仕様のセクション 7 と呼ばれます。 RPC 書式設定では、すべてのパラメーターが XML Web サービス メソッドにちなんだ 1 つの XML 要素内にカプセル化され、その XML 要素内の各 XML 要素が、その XML 要素が表すパラメーターにちなんだパラメーターを表すという状態になります。

スタイルとDocument両方RPCで書式設定された SOAP メッセージは、リモート プロシージャ コール (RPC) の方法で XML Web サービスと通信するために使用できますがDocument、スタイルは疎結合の方法で簡単に通信するためにも使用できます。 そのため、 Document スタイル XML Web サービスをお勧めします。 詳細については、トピックを Customizing SOAP Messages 参照してください。

詳細については、「 SOAP メッセージの書式設定のカスタマイズ」を参照してください。

この属性は、サーバー上の XML Web サービス メソッドとクライアント上のプロキシ クラスに適用できます。 プロパティが設定されている OneWay XML Web サービス メソッドは、そのHttpContextメソッドにtrueアクセスできません。 そのため、クラスのプロパティのいずれかにアクセスすると、次の値が WebService 返されます null

コンストラクター

SoapRpcMethodAttribute()

すべてのプロパティを既定値に設定して、SoapRpcMethodAttribute クラスの新しいインスタンスを初期化します。

SoapRpcMethodAttribute(String)

SoapRpcMethodAttribute プロパティを action パラメーターの値に設定して、Action クラスの新しいインスタンスを初期化します。

プロパティ

Action

SOAP 要求の SOAPAction HTTP ヘッダー フィールドを取得または設定します。

Binding

XML Web サービス メソッドが実装している操作のバインディングを取得または設定します。

OneWay

Web サーバーが XML Web サービス メソッドの処理を完了するまで XML Web サービス クライアントが待機するかどうかを示す値を取得または設定します。

RequestElementName

XML Web サービス メソッドに対する SOAP 要求に関連付けられている XML 要素を取得または設定します。

RequestNamespace

XML Web サービス メソッドに対する SOAP 要求に関連付けられている XML 名前空間を取得または設定します。

ResponseElementName

XML Web サービス メソッドに対する SOAP 応答に関連付けられている XML 要素を取得または設定します。

ResponseNamespace

XML Web サービス メソッドに対する SOAP 応答に関連付けられている XML 名前空間を取得または設定します。

TypeId

派生クラスで実装されると、この Attribute の一意の識別子を取得します。

(継承元 Attribute)
Use

メソッドを呼び出すときに使用されるバインディングを取得または設定します。

メソッド

Equals(Object)

このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。

(継承元 Attribute)
GetHashCode()

このインスタンスのハッシュ コードを返します。

(継承元 Attribute)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

(継承元 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。

(継承元 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

(継承元 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。

(継承元 Attribute)

適用対象

こちらもご覧ください