SoapDocumentMethodAttribute.ParameterStyle Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает или задает, инкапсулируются ли параметры в одном XML-элементе Body под элементом в XML-части сообщения SOAP.
public:
property System::Web::Services::Protocols::SoapParameterStyle ParameterStyle { System::Web::Services::Protocols::SoapParameterStyle get(); void set(System::Web::Services::Protocols::SoapParameterStyle value); };
public System.Web.Services.Protocols.SoapParameterStyle ParameterStyle { get; set; }
member this.ParameterStyle : System.Web.Services.Protocols.SoapParameterStyle with get, set
Public Property ParameterStyle As SoapParameterStyle
Значение свойства
Сообщения SoapParameterStyle SOAP, отправляемые в метод веб-службы XML и из нее. Значение по умолчанию — Wrapped.
Примеры
В следующем примере кода указывается, что параметры, отправленные в сообщения SOAP, отправляемые в метод веб-службы XML, PlaceOrder не инкапсулируются в одном XML-элементе.
<%@ WebService Language="C#" Class="ShoppingCart" %>
using System.Web.Services;
using System.Web.Services.Protocols;
using System;
public class ShoppingCart
{
// Specify that parameters are not encapsulated within one XML element.
[ SoapDocumentMethod(ParameterStyle=SoapParameterStyle.Bare) ]
[ WebMethod]
public void PlaceOrder(OrderItem OrderDetails)
{
// 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
Public Class ShoppingCart
' Specify that parameters are not encapsulated within one XML element.
<SoapDocumentMethod(ParameterStyle:=SoapParameterStyle.Bare), _
WebMethod()> _
Public Sub PlaceOrder(OrderDetails 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