SoapRpcServiceAttribute 類別

定義

針對在 XML Web Service 內的 XML Web Service 方法中往返傳送的 SOAP 要求和回應設定預設格式。

public ref class SoapRpcServiceAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class SoapRpcServiceAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type SoapRpcServiceAttribute = class
    inherit Attribute
Public NotInheritable Class SoapRpcServiceAttribute
Inherits Attribute
繼承
SoapRpcServiceAttribute
屬性

範例

下列範例將示範如何使用 SoapRpcServiceAttribute 類別。

<%@ WebService Language="c#" Class="SumService" %>

using System;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Services.Description;

    [SoapRpcService(RoutingStyle=SoapServiceRoutingStyle.SoapAction)]
    public class SumService : System.Web.Services.WebService
    {
        [WebMethod]
        public int Add(int a, int b)
        {
            return a + b;
        }
    }
<%@ WebService Language="VB" Class="SumService" %>

Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.Services.Description

    <SoapRpcServiceAttribute(RoutingStyle:=SoapServiceRoutingStyle.SoapAction)> _
    Public Class SumService 
          Inherits System.Web.Services.WebService
    
        <WebMethod> _
        Public Function Add(a As Integer, b as Integer)
           return a + b
        End Function
    End Class

備註

SoapRpcServiceAttribute可讓您將 XML Web 服務內 XML Web 服務方法的預設編碼樣式設定為 RPC 方法編碼和 Encoded 參數編碼。

Web 服務描述語言 (WSDL) 定義兩種樣式,說明 XML Web 服務方法或作業如何在 SOAP 要求或 SOAP 回應中編碼: RPCDocumentRPC此樣式是指根據 SOAP 規格的第 7 節編碼 XML Web 服務方法,以使用 SOAP for RPC。 此樣式指定所有參數都會封裝在 XML Web 服務方法之後命名的單一元素內,而且該元素內的每個元素都代表以其個別參數名稱命名的參數。

若要將預設方法層級編碼設定為 Document ,請將 套用 SoapDocumentServiceAttribute 至實作 XML Web 服務的 類別。

如需詳細資訊,請參閱 自訂 SOAP 訊息格式

這個屬性可以套用至實作 XML Web 服務的類別。

建構函式

SoapRpcServiceAttribute()

初始化 SoapRpcServiceAttribute 類別的新執行個體。

屬性

RoutingStyle

取得或設定 SOAP 訊息如何傳送至 XML Web Service。

TypeId

在衍生類別中實作時,取得這個 Attribute 的唯一識別碼。

(繼承來源 Attribute)
Use

取得或設定叫用 Web 服務方法時使用的繫結。

方法

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)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。

(繼承來源 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。

(繼承來源 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。

(繼承來源 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開的屬性和方法的存取權。

(繼承來源 Attribute)

適用於

另請參閱