OperationFormatStyle 列舉

定義

代表 SOAP 樣式,此樣式會判斷該服務之 WSDL 中繼資料格式化的方式。

public enum class OperationFormatStyle
public enum OperationFormatStyle
type OperationFormatStyle = 
Public Enum OperationFormatStyle
繼承
OperationFormatStyle

欄位

Document 0

產生 WSDL 表示法以包含一個代表文件的項目,此文件會為某作業進行交換。

Rpc 1

產生為某個作業交換之訊息的 WSDL 表示法,並如同遠端程序呼叫一般含有參數。

範例

下列程式碼將示範如何使用這個列舉。

[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples"),
XmlSerializerFormat(Style = OperationFormatStyle.Rpc,
                                 Use = OperationFormatUse.Encoded)]
public interface IUseAndStyleCalculator
{
    [OperationContract]
    double Add(double n1, double n2);
    [OperationContract]
    double Subtract(double n1, double n2);
    [OperationContract]
    double Multiply(double n1, double n2);
    [OperationContract]
    double Divide(double n1, double n2);
}
<ServiceContract(Namespace:="http://Microsoft.ServiceModel.Samples"), _
XmlSerializerFormat(Style:=OperationFormatStyle.Rpc, _
                    Use:=OperationFormatUse.Encoded)> _
Public Interface IUseAndStyleCalculator

    <OperationContract()> _
    Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double

    <OperationContract()> _
    Function Subtract(ByVal n1 As Double, ByVal n2 As Double) As Double

    <OperationContract()> _
    Function Multiply(ByVal n1 As Double, ByVal n2 As Double) As Double

    <OperationContract()> _
    Function Divide(ByVal n1 As Double, ByVal n2 As Double) As Double

End Interface

備註

根據預設,郵件本文的格式設定為 [檔]。 樣式 RPC 代表為某個作業交換之訊息的 WSDL 表示法,如同遠端程序呼叫一般含有參數。 以下是一個範例。

<wsdl:message name="IUseAndStyleCalculator_Add_InputMessage">  
  <wsdl:part name="n1" type="xsd:double"/>  
  <wsdl:part name="n2" type="xsd:double"/>  
</wsdl:message>  

將樣式設為 Document 代表 WSDL 表示法含有一個代表文件的項目,此文件會為某作業進行交換,如以下範例所示。

<wsdl:message name="IUseAndStyleCalculator_Add_InputMessage">  
  <wsdl:part name="parameters" element="tns:Add"/>  
</wsdl:message>  

您可以使用 System.ServiceModel.XmlSerializerFormatAttribute 設定這個值。

適用於