Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SoapDocumentServiceAttribute Class

Applying the optional SoapDocumentServiceAttribute to an XML Web service sets the default format of SOAP requests and responses sent to and from XML Web service methods within the XML Web service.

For a list of all members of this type, see SoapDocumentServiceAttribute Members.

System.Object
   System.Attribute
      System.Web.Services.Protocols.SoapDocumentServiceAttribute

[Visual Basic]
<AttributeUsage(AttributeTargets.Class)>
NotInheritable Public Class SoapDocumentServiceAttribute
   Inherits Attribute
[C#]
[AttributeUsage(AttributeTargets.Class)]
public sealed class SoapDocumentServiceAttribute : Attribute
[C++]
[AttributeUsage(AttributeTargets::Class)]
public __gc __sealed class SoapDocumentServiceAttribute : public
   Attribute
[JScript]
public
   AttributeUsage(AttributeTargets.Class)
class SoapDocumentServiceAttribute extends Attribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

The SoapDocumentServiceAttribute allows you to set the default formatting styles for XML Web service methods within an XML Web service. If an individual XML Web service method must change these defaults, apply a SoapDocumentMethodAttribute to that XML Web service method.

Web Services Description Language (WSDL) defines two styles for how an XML Web service method, which it calls an operation, can be formatted in a SOAP request or a SOAP response: RPC and Document. Exactly how the individual message parts is determined by the Use and ParameterStyle properties. The Use property determines whether parameters are formatted Encoded or Literal. The ParameterStyle determines whether the parameters are encapsulated within a single message part beneath the Body element, or whether each parameter is an individual message part.

To set the default method level formatting to RPC, apply a SoapRpcServiceAttribute to the class implementing the XML Web service.

For more details, see Customizing SOAP Messages.

This attribute can be applied to a class implementing an XML Web service.

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, _
                             RoutingStyle := SoapServiceRoutingStyle.SoapAction)> _
    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,
                         RoutingStyle=SoapServiceRoutingStyle.SoapAction)]
    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

Namespace: System.Web.Services.Protocols

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

Assembly: System.Web.Services (in System.Web.Services.dll)

See Also

SoapDocumentServiceAttribute Members | System.Web.Services.Protocols Namespace | SoapDocumentMethodAttribute | SoapRpcServiceAttribute | Customizing SOAP Messages

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft