SoapRpcMethodAttribute クラス
定義
メソッドとやり取りされる SOAP メッセージの書式として RPC
スタイルを使用することを指定します。Specifies that SOAP messages sent to and from the method use RPC
formatting.
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
- 継承
- 属性
例
次のコード例では、 Rpc
XML Web サービスメソッドのメッセージスタイルをに設定し GetUserName
ます。The following code example sets the message style to Rpc
for the GetUserName
XML Web service method.
<%@ 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) では、SOAP メッセージ内で XML Web サービスメソッドまたは操作を書式設定する方法について、との2つのスタイルを定義 RPC
し Document
ます。Web Services Description Language (WSDL) defines two styles for how an XML Web service method, or operation, can be formatted in a SOAP message: RPC
and Document
. RPC
書式設定とは、RPC に SOAP を使用するための SOAP 仕様に従って操作を書式設定することを意味します。それ以外の場合は、SOAP 仕様のセクション7と呼ばれます。RPC
formatting refers to formatting the operation according to the SOAP specification for using SOAP for RPC; otherwise known as Section 7 of the SOAP specification. RPC
書式設定とは、すべてのパラメーターが XML Web サービスメソッドの後の1つの XML 要素内にカプセル化され、その XML 要素内の各 XML 要素が、それが表すパラメーターの後に指定されたパラメーターを表すことを意味します。RPC
formatting states that all parameters are encapsulated within a single XML element named after the XML Web service method and that each XML element within that XML element represents a parameter named after the parameter it is representing.
およびスタイルの両方で書式設定された SOAP メッセージは、 RPC
Document
リモートプロシージャコール (RPC) の方法で XML Web サービスと通信するために使用できます。ただし、このスタイルは、 Document
疎結合方式での通信にも簡単に使用できます。SOAP messages formatted in both the RPC
and Document
styles can be used to communicate with an XML Web service in a Remote Procedure Call (RPC) manner; however the Document
style can also easily be used to communicate in a loosely coupled manner. そのため、 Document
スタイルの XML Web サービスをお勧めします。Therefore, Document
style XML Web services is recommended. 詳細については、「」を参照してください Customizing SOAP Messages
。For more details, see the Customizing SOAP Messages
topic.
詳細については、「 SOAP メッセージの書式設定のカスタマイズ」を参照してください。For more details, see Customizing SOAP Message Formatting.
この属性は、サーバー上の XML Web サービスメソッドと、クライアント上のプロキシクラスに適用できます。This attribute can be applied to an XML Web service method on the server and a proxy class on the client. プロパティがに設定されている XML Web サービスメソッド OneWay true
は、にアクセスできません HttpContext 。XML Web service methods that have the OneWay property set to true
do not have access to their HttpContext. そのため、クラスのプロパティにアクセスすると、が WebService 返さ null
れます。As such, accessing any of the properties of the WebService class return null
.
コンストラクター
SoapRpcMethodAttribute() |
すべてのプロパティを既定値に設定して、SoapRpcMethodAttribute クラスの新しいインスタンスを初期化します。Initializes a new instance of the SoapRpcMethodAttribute class, setting all properties to their default values. |
SoapRpcMethodAttribute(String) |
SoapRpcMethodAttribute プロパティを |
プロパティ
Action |
SOAP 要求の |
Binding |
XML Web サービス メソッドが実装している操作のバインディングを取得または設定します。Gets or sets the binding that an XML Web service method implements an operation for. |
OneWay |
Web サーバーが XML Web サービス メソッドの処理を完了するまで XML Web サービス クライアントが待機するかどうかを示す値を取得または設定します。Gets or sets whether an XML Web service client waits for the Web server to finish processing an XML Web service method. |
RequestElementName |
XML Web サービス メソッドに対する SOAP 要求に関連付けられている XML 要素を取得または設定します。Gets or sets the XML element associated with the SOAP request for an XML Web service method. |
RequestNamespace |
XML Web サービス メソッドに対する SOAP 要求に関連付けられている XML 名前空間を取得または設定します。Gets or sets the XML namespace associated with the SOAP request for an XML Web service method. |
ResponseElementName |
XML Web サービス メソッドに対する SOAP 応答に関連付けられている XML 要素を取得または設定します。Gets or sets the XML element associated with the SOAP response for an XML Web service method. |
ResponseNamespace |
XML Web サービス メソッドに対する SOAP 応答に関連付けられている XML 名前空間を取得または設定します。Gets or sets the XML namespace associated with the SOAP response for an XML Web service method. |
TypeId |
派生クラスで実装されると、この Attribute の一意の識別子を取得します。When implemented in a derived class, gets a unique identifier for this Attribute. (継承元 Attribute) |
Use |
メソッドを呼び出すときに使用されるバインディングを取得または設定します。Gets or sets the binding used when invoking the method. |
メソッド
Equals(Object) |
このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。Returns a value that indicates whether this instance is equal to a specified object. (継承元 Attribute) |
GetHashCode() |
このインスタンスのハッシュ コードを返します。Returns the hash code for this instance. (継承元 Attribute) |
GetType() |
現在のインスタンスの Type を取得します。Gets the Type of the current instance. (継承元 Object) |
IsDefaultAttribute() |
派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (継承元 Attribute) |
Match(Object) |
派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (継承元 Attribute) |
MemberwiseClone() |
現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object. (継承元 Object) |
ToString() |
現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object. (継承元 Object) |
明示的なインターフェイスの実装
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
一連の名前を対応する一連のディスパッチ識別子に割り当てます。Maps a set of names to a corresponding set of dispatch identifiers. (継承元 Attribute) |
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。Retrieves the type information for an object, which can be used to get the type information for an interface. (継承元 Attribute) |
_Attribute.GetTypeInfoCount(UInt32) |
オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。Retrieves the number of type information interfaces that an object provides (either 0 or 1). (継承元 Attribute) |
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。Provides access to properties and methods exposed by an object. (継承元 Attribute) |