This documentation is archived and is not being maintained.

SoapRpcServiceAttribute Class

Applying the optional SoapRpcServiceAttribute 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 SoapRpcServiceAttribute Members.


[Visual Basic]
NotInheritable Public Class SoapRpcServiceAttribute
   Inherits Attribute
public sealed class SoapRpcServiceAttribute : Attribute
public __gc __sealed class SoapRpcServiceAttribute : public
class SoapRpcServiceAttribute 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.


The SoapRpcServiceAttribute allows you to set the default encoding style for XML Web service methods, within an XML Web service to RPC method encoding and Encoded parameter encoding.

Web Services Description Language (WSDL) defines two styles for how an XML Web service method, which it calls an operation, can be encoded in a SOAP request or a SOAP response: RPC and Document. The RPC style refers to encoding the XML Web service method according to the SOAP specification for using SOAP for RPC; otherwise known as Section 7 of the SOAP specification. This style specifies that all parameters are encapsulated within a single element named after the XML Web service method, and that each element within that element represents a parameter named after their respective parameter name.

To set the default method level encoding to Document, apply a SoapDocumentServiceAttribute 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.


[Visual Basic] 
<%@ WebService Language="VB" Class="SumService" %>

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

    <SoapRpcServiceAttribute(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

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

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

    public class SumService : System.Web.Services.WebService
        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.


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

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

See Also

SoapRpcServiceAttribute Members | System.Web.Services.Protocols Namespace | SoapDocumentServiceAttribute | SoapRpcMethodAttribute | SoapBindingUse | SoapServiceRoutingStyle