OperationFormatStyle Enumeration
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Stellt die SOAP-Formatvorlage dar, die bestimmt, wie die WSDL-Metadaten für den Dienst formatiert werden.
public enum class OperationFormatStyle
public enum OperationFormatStyle
type OperationFormatStyle =
Public Enum OperationFormatStyle
- Vererbung
Felder
| Name | Wert | Beschreibung |
|---|---|---|
| Document | 0 | Bewirkt, dass die WSDL-Darstellung ein einzelnes Element enthält, das das Dokument darstellt, das für den Vorgang ausgetauscht wird. |
| Rpc | 1 | Verursacht die WSDL-Darstellung von Nachrichten, die für einen Vorgang ausgetauscht werden, und enthält Parameter, als wäre es ein Remoteprozeduraufruf. |
Beispiele
Der folgende Code zeigt, wie diese Enumeration verwendet wird.
[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
Hinweise
Standardmäßig ist der Nachrichtentext mit dem Formatvorlagensatz auf "Dokument" formatiert. Die Formatvorlage RPC bedeutet, dass die WSDL-Darstellung von Nachrichten, die für einen Vorgang ausgetauscht werden, Parameter enthält, als ob es sich um einen Remoteprozeduraufruf handelt. Im Folgenden finden Sie ein Beispiel.
<wsdl:message name="IUseAndStyleCalculator_Add_InputMessage">
<wsdl:part name="n1" type="xsd:double"/>
<wsdl:part name="n2" type="xsd:double"/>
</wsdl:message>
Das Festlegen der Formatvorlage Document bedeutet, dass die WSDL-Darstellung ein einzelnes Element enthält, das das Dokument darstellt, das für einen Vorgang ausgetauscht wird, wie im folgenden Beispiel gezeigt.
<wsdl:message name="IUseAndStyleCalculator_Add_InputMessage">
<wsdl:part name="parameters" element="tns:Add"/>
</wsdl:message>
Verwenden Sie den System.ServiceModel.XmlSerializerFormatAttribute Wert, um diesen Wert festzulegen.