This documentation is archived and is not being maintained.

SoapDocumentServiceAttribute.Use Property

Gets or sets the default parameter formatting for an XML Web service.

[Visual Basic]
Public Property Use As SoapBindingUse
[C#]
public SoapBindingUse Use {get; set;}
[C++]
public: __property SoapBindingUse get_Use();
public: __property void set_Use(SoapBindingUse);
[JScript]
public function get Use() : SoapBindingUse;
public function set Use(SoapBindingUse);

Property Value

The default SoapBindingUse for the XML Web service. If not set, the default is Literal.

Remarks

The Web Services Description Language (WSDL) defines two formatting styles for parameters sent to and from XML Web services: Encoded and Literal. Encoded refers to formatting the parameters using the SOAP encoding outlined in the SOAP specification in section 5. Literal refers to formatting the parameters using a predefined XSD schema for each parameter.

For more details, see Customizing SOAP Messages.

Example

[Visual Basic] 
<%@ 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

[C#] 
<%@ 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;
        }
    }

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

SoapDocumentServiceAttribute Class | SoapDocumentServiceAttribute Members | System.Web.Services.Protocols Namespace | SoapBindingUse | Customizing SOAP Messages

Show: