views:

610

answers:

2

I've create a regular old ASMX web service in ASP.NET and added SoapDocumentMethod(OneWay = true)] to the function call as I've read this is supposed to make the call Asynchronous. However I call this in my code and it definitely does not make the call asynchronous, my page just sits there waiting for the function to finish working. What gives?

[SoapDocumentMethod(OneWay = true)]
[WebMethod(EnableSession = true)]
public void UpdateAccounts()
{
 //do work
}

//call the function
GlobalServices service = new GlobalServices();
service .UpdateAccounts()
+2  A: 

You still have to make the call using the Async method. You should make the call to service.UpdateAccountsAsync() in this case.

Erich
Except that the documentation for OneWay states that the web service will return an HTTP status code 202 immediately, prior to executing the service method, so I don't think making the service function asynchronous is going to help.
Robert Harvey
This is my understanding of how it works, or how it's supposed to work.
Chris
A: 

Are you returning a value? The documentation for OneWay states that "fire and forget" web methods cannot return a value or have out parameters.

http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapdocumentmethodattribute.oneway(VS.80).aspx

Robert Harvey
Nope, not returning anything.
Chris
Try removing your function and see if the web service returns. If it does, then I guess you do need to fire your service function asynchronously, as Erich stated.
Robert Harvey
The only other thing I can think of is that the "EnableSession" attribute is somehow interfering with the asynchronous behavior. Try removing that as well.
Robert Harvey