Anatoly Lubarsky Logo
MSSQL, .NET, Design. Life and Music

Webservice Tip: One-Way (Fire-and-Forget) Webmethod

Occasionally when consuming a webservice, client does not require a response.


Using the OneWay property of SoapDocumentMethod under System.Web.Services.Protocols frees the client thread immediately instead of forcing it to wait for a response. The OneWay attribute can be specified like so:


[SoapDocumentMethod(OneWay=true)]
[WebMethod(Description="my method")]
public void MyMethod() 
{
    ...
}

Method should be marked as void.


What is happening behind the scenes:


  1. The message is read and deserialized by the service.
  2. The webmethod name is evaluated.
  3. The server returns an HTTP 202 status code to the client (this should be visible in WSDL).
  4. The webmethod is processed.

Related Posts:

Monday, May 21, 2007 12:37 AM

If your feedback doesn't appear right away, please be patient as it may take a few minutes to publish.

Post a Comment

Protected by CAPTCHAEnter the code you see
Name (*)  
E-mail (*)  
Url
Remember

Comment (*)