SoapDocumentMethodAttribute.Use Property
Gets or sets the parameter formatting for an XML Web service method within the XML portion of a SOAP message.
[Visual Basic] Public Property Use As SoapBindingUse [C#] public SoapBindingUse Use {get; set;} [C++] public: __property SoapBindingUse get_Use(); public: __property void set_Use(SoapBindingUse); [JScript] public function get Use() : SoapBindingUse; public function set Use(SoapBindingUse);
Property Value
The SoapBindingUse for the XML Web service method. The default is Literal.
Remarks
The Web Services Description Language (WSDL) defines two methods for formatting parameters: Encoded and Literal. Encoded refers to formatting parameters using SOAP encoding, as outlined in the SOAP specification in section 5. Literal refers to formatting the parameters using a pre-defined XSD schema for each parameter.
For more details, see Customizing SOAP Messages.
Example
[Visual Basic, C#] The following code example specifies that Document/ Encoded SOAP messages must be sent to the PlaceOrder XML Web service method.
[Visual Basic] <%@ 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 [C#] <%@ 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; }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
See Also
SoapDocumentMethodAttribute Class | SoapDocumentMethodAttribute Members | System.Web.Services.Protocols Namespace | SoapBindingUse | Customizing SOAP Messages