OperationFormatStyle Enum

Definition

Representerar SOAP-formatet som avgör hur WSDL-metadata för tjänsten formateras.

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

Fält

Name Värde Description
Document 0

Gör att WSDL-representationen innehåller ett enda element som representerar dokumentet som utbyts för åtgärden.

Rpc 1

Orsakar WSDL-representationen av meddelanden som utbyts för en åtgärd och innehåller parametrar som om det vore ett fjärrproceduranrop.

Exempel

Följande kod visar hur du använder den här uppräkningen.

[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

Kommentarer

Som standard formateras meddelandetexten med formatmallen inställd på Dokument. Formatet RPC innebär att WSDL-representationen av meddelanden som utbyts för en åtgärd innehåller parametrar som om det vore ett fjärrproceduranrop. Följande är ett exempel.

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

Om du anger formatmallen till Document innebär det att WSDL-representationen innehåller ett enda element som representerar dokumentet som utbyts för en åtgärd enligt följande exempel.

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

Använd för System.ServiceModel.XmlSerializerFormatAttribute att ange det här värdet.

Gäller för