SoapDocumentServiceAttribute.Use 属性

定义

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

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 服务的默认值 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 消息格式

适用于

另请参阅