SoapDocumentMethodAttribute.Use Proprietà

Definizione

Ottiene o imposta la formattazione dei parametri per un metodo di servizio Web XML all'interno della porzione XML di un messaggio SOAP.

public:
 property System::Web::Services::Description::SoapBindingUse Use { System::Web::Services::Description::SoapBindingUse get(); void set(System::Web::Services::Description::SoapBindingUse value); };
public System.Web.Services.Description.SoapBindingUse Use { get; set; }
member this.Use : System.Web.Services.Description.SoapBindingUse with get, set
Public Property Use As SoapBindingUse

Valore della proprietà

SoapBindingUse

SoapBindingUse per il metodo di servizio Web XML. Il valore predefinito è Literal.

Esempio

Nell'esempio di codice seguente viene specificato che Document / Encoded i messaggi SOAP devono essere inviati al metodo del PlaceOrder servizio Web XML.

<%@ 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;
}
<%@ 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

Commenti

Il linguaggio WSDL (Web Services Description Language) definisce due metodi per la formattazione dei parametri: Encoded e Literal. Encoded si riferisce alla formattazione dei parametri usando la codifica SOAP, come descritto nella specifica SOAP nella sezione 5. Literal fa riferimento alla formattazione dei parametri usando uno schema XSD predefinito per ogni parametro.

Per altre informazioni, vedere Personalizzazione della formattazione dei messaggi SOAP.

Si applica a

Vedi anche