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:
- The message is read and deserialized by the service.
- The webmethod name is evaluated.
- The server returns an HTTP 202 status code to the client (this should be visible in WSDL).
- The webmethod is processed.
Monday, May 21, 2007 12:37 AM