SoapDocumentServiceAttribute.Use Свойство

Определение

Получает или задает форматирование параметров по умолчанию для веб-службы XML.

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

Значение свойства

Объект SoapBindingUse по умолчанию для веб-службы XML. Если стиль не установлен, по умолчанию используется значение поля Literal.

Примеры

<%@ WebService Language="c#" Class="SumService" %>

using System;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Services.Description;

    [SoapDocumentService(SoapBindingUse.Literal,
                         SoapParameterStyle.Wrapped)]
    public class SumService : System.Web.Services.WebService
    {
        [WebMethod]
        public int Add(int a, int b)
        {
            return a + b;
        }
    }
<%@ WebService Language="VB" Class="SumService" %>

Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.Services.Description

    <SoapDocumentService(SoapBindingUse.Literal, _
                             SoapParameterStyle.Wrapped)> _
    Public Class SumService 
          Inherits System.Web.Services.WebService
    
        <WebMethod> _
        Public Function Add(a As Integer, b as Integer)
           return a + b
        End Function
    End Class

Комментарии

Язык описания веб-служб (WSDL) определяет два стиля форматирования для параметров, отправляемых в веб-службы XML и из нее: Encoded и Literal. Encoded относится к форматированию параметров с помощью кодировки SOAP, описанной в спецификации SOAP в разделе 5. Literal ссылается на форматирование параметров с помощью предопределенной схемы XSD для каждого параметра.

Дополнительные сведения см. в разделе Настройка форматирования сообщений SOAP.

Применяется к

См. также раздел