SoapDocumentMethodAttribute.Use Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Lekéri vagy beállítja egy XML-webszolgáltatás-metódus paraméterformázását egy SOAP-üzenet XML-részén belül.
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
Tulajdonság értéke
Az SoapBindingUse XML webszolgáltatás metódusa. Az alapértelmezett érték a Literal.
Példák
Az alábbi példakód azt határozza meg, hogy Document / Encoded a SOAP-üzeneteket el kell küldeni az PlaceOrder XML webszolgáltatás metódusának.
<%@ 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
Megjegyzések
A Web Services Description Language (WSDL) két metódust határoz meg a paraméterek formázásához: Encoded és Literal. Encoded a SOAP kódolást használó formázási paraméterekre hivatkozik, az 5. szakaszban található SOAP-specifikációban leírtak szerint. Literal A paraméterek formázására hivatkozik egy előre definiált XSD-séma használatával az egyes paraméterekhez.
További részletekért lásd: SOAP-üzenetformázás testreszabása.