Uređivanje

Dijeli putem


OperationFormatStyle Enum

Definition

Represents the SOAP style that determines how the WSDL metadata for the service is formatted.

public enum class OperationFormatStyle
public enum OperationFormatStyle
type OperationFormatStyle = 
Public Enum OperationFormatStyle
Inheritance
OperationFormatStyle

Fields

Name Value Description
Document 0

Causes the WSDL representation to contain a single element that represents the document that is exchanged for the operation.

Rpc 1

Causes the WSDL representation of messages exchanged for an operation and contains parameters as if it were a remote procedure call.

Examples

The following code shows how to use this enumeration.

[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

Remarks

By default, the message body is formatted with the Style set to Document. The style RPC means that the WSDL representation of messages exchanged for an operation contains parameters as if it were a remote procedure call. The following is an example.

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

Setting the style to Document means that the WSDL representation contains a single element that represents the document that is exchanged for an operation as shown in the following example.

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

Use the System.ServiceModel.XmlSerializerFormatAttribute to set this value.

Applies to