DekGenius.com
[ Team LiB ] Previous Section Next Section

SoapDocumentMethodAttribute

System.Web.Services.Protocols (system.web.services.dll)sealed class

This attribute is used to specify the encoding for SOAP request and response messages. You can apply this attribute to methods in a web service or in methods in a proxy class that derives from SoapHttpClientProtocol (where it's required to bind the messages to the appropriate web method). You use this attribute, instead of SoapRpcMethodAttribute, when you want to use the Document encoding standard.

There are two options for encoding XML information in a SOAP message: RPC and Document. ASP.NET's default is Document. The Document style specifies that messages are encoded as described in an XSD schema. When Document style is used, the WSDL document defines the XSD schemas for SOAP requests and SOAP responses. For more information on the SOAP specification, see http://www.w3.org/TR/SOAP/.

One reason you might want to apply this attribute to a web method is to explicitly set the OneWay property. For example, by adding [SoapDocumentMethod(OneWay = true)] before a web method, you ensure that the method will return immediately and can finish processing asynchronously. This ensures that the client doesn't need to wait for the method to return or call it asynchronously. However, this web method will not be able to access the System.Web.HttpContext for the client and will not be able to set a return value. If the client needs to know about the success or result of such a web method, you will have to implement a second method and use some type of ticket-issuing system to keep track of the outstanding request.

public sealed class SoapDocumentMethodAttribute : Attribute {
// Public Constructors
   public SoapDocumentMethodAttribute( );
   public SoapDocumentMethodAttribute(string action);
// Public Instance Properties
   public string Action{set; get; }
   public string Binding{set; get; }
   public bool OneWay{set; get; }
   public SoapParameterStyle ParameterStyle{set; get; }
   public string RequestElementName{set; get; }
   public string RequestNamespace{set; get; }
   public string ResponseElementName{set; get; }
   public string ResponseNamespace{set; get; }
   public SoapBindingUse Use{set; get; }
}

Hierarchy

System.Object System.Attribute SoapDocumentMethodAttribute

Valid On

Method

    [ Team LiB ] Previous Section Next Section