语言

OperationFormatStyle 枚举

定义

表示确定服务的 WSDL 元数据的格式的 SOAP 样式。

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 此值。

适用于