SoapDocumentServiceAttribute.Use 属性

定义

获取或设置 XML Web services 的默认参数格式设置。

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

属性值

XML Web services 的默认 SoapBindingUse。 如果未设置,则默认为 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

注解

Web 服务描述语言 (WSDL) 定义两种格式样式,用于向和从 XML Web 服务发送的参数: EncodedLiteralEncoded 是指使用第 5 节的 SOAP 规范中概述的 SOAP 编码设置参数的格式。 Literal 是指使用每个参数的预定义 XSD 架构设置参数的格式。

有关详细信息,请参阅 自定义 SOAP 消息格式

适用于

另请参阅