Name

SoapDocumentMethodAttribute

Synopsis

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 ...

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.