SoapDocumentMethodAttribute.Use-Eigenschaft
Ruft die Parameterformatierung für eine XML-Webdienstmethode innerhalb des XML-Teils einer SOAP-Nachricht ab oder legt diese fest.
Namespace: System.Web.Services.Protocols
Assembly: System.Web.Services (in system.web.services.dll)
Syntax
'Declaration
Public Property Use As SoapBindingUse
'Usage
Dim instance As SoapDocumentMethodAttribute
Dim value As SoapBindingUse
value = instance.Use
instance.Use = value
public SoapBindingUse Use { get; set; }
public:
property SoapBindingUse Use {
SoapBindingUse get ();
void set (SoapBindingUse value);
}
/** @property */
public SoapBindingUse get_Use ()
/** @property */
public void set_Use (SoapBindingUse value)
public function get Use () : SoapBindingUse
public function set Use (value : SoapBindingUse)
Eigenschaftenwert
Die SoapBindingUse für die XML-Webdienstmethode. Der Standardwert ist Literal.
Hinweise
WSDL (Web Services Description Language) definiert zwei Methoden der Parameterformatierung: Encoded und Literal. Encoded bezieht sich auf die Formatierung von Parametern unter Verwendung von SOAP-Codierung (entsprechend der Beschreibung in der SOAP-Spezifikation in Abschnitt 5). Literal bezieht sich auf die Formatierung der Parameter mit einem vordefinierten XSD-Schema für jeden Parameter.
Weitere Informationen finden Sie unter Anpassen der Formatierung von SOAP-Nachrichten.
Beispiel
Im folgenden Codebeispiel wird festgelegt, dass Document / Encoded-SOAP-Nachrichten an die PlaceOrder
-XML-Webdienstmethode gesendet werden müssen.
<%@ WebService Language="VB" Class="ShoppingCart" %>
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.Services.Description
Imports System
Public Class ShoppingCart
' Specify that the XML Web service method uses encoded SOAP messages.
<SoapDocumentMethod(Use:=SoapBindingUse.Encoded), _
WebMethod()> _
Public Sub PlaceOrder(O as OrderItem)
' Process the order on the back end.
End Sub
End Class
Public Class OrderItem
Public Count As Integer
Public Description as String
Public OrderDate as DateTime
Public CustomerID as Long
Public Cost as Decimal
End Class
<%@ WebService Language="C#" Class="ShoppingCart" %>
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Services.Description;
using System;
public class ShoppingCart
{
[ SoapDocumentMethod(Use=SoapBindingUse.Encoded) ]
[ WebMethod]
public void PlaceOrder(OrderItem O)
{
// Process the order on the back end.
}
}
public class OrderItem
{
public int Count;
public int Description;
public DateTime OrderDate;
public long CustomerID;
public Decimal Cost;
}
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
SoapDocumentMethodAttribute-Klasse
SoapDocumentMethodAttribute-Member
System.Web.Services.Protocols-Namespace
SoapBindingUse-Enumeration