SoapDocumentMethodAttribute.Use Property

Definition

Gets or sets the parameter formatting for an XML Web service method within the XML portion of a SOAP message.

C#
public System.Web.Services.Description.SoapBindingUse Use { get; set; }

Property Value

The SoapBindingUse for the XML Web service method. The default is Literal.

Examples

The following code example specifies that Document / Encoded SOAP messages must be sent to the PlaceOrder XML Web service method.

ASP.NET (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;
}

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 Message Formatting.

Applies to

Produkt Versioner
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also