OperationFormatStyle Wyliczenie

Definicja

Reprezentuje styl protokołu SOAP określający sposób formatowania metadanych WSDL dla usługi.

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

Pola

Document 0

Powoduje, że reprezentacja WSDL zawiera pojedynczy element reprezentujący dokument wymieniany dla operacji.

Rpc 1

Powoduje reprezentację WSDL komunikatów wymienianych dla operacji i zawiera parametry tak, jakby było to zdalne wywołanie procedury.

Przykłady

Poniższy kod pokazuje, jak używać tego wyliczenia.

[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

Uwagi

Domyślnie treść komunikatu jest formatowana przy użyciu ustawienia Styl na Dokument. Styl RPC oznacza, że reprezentacja komunikatów w formacie WSDL wymienianych dla operacji zawiera parametry tak, jakby było to zdalne wywołanie procedury. Poniżej przedstawiono przykład.

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

Ustawienie stylu Document na wartość oznacza, że reprezentacja WSDL zawiera pojedynczy element reprezentujący dokument wymieniany dla operacji, jak pokazano w poniższym przykładzie.

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

Użyj wartości , System.ServiceModel.XmlSerializerFormatAttribute aby ustawić tę wartość.

Dotyczy