Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. confusion over asynchronous methods inside web service

confusion over asynchronous methods inside web service

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netcomhelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ekynox
    wrote on last edited by
    #1

    Hi there, I have been looking into implementing Asynchronous programming model within my webservice and my asp.net web form. I have found a few good MSDN articles, [^], to achieve this but there is one thing I do not quite follow. My webservice code is as listed below. I add all the relevant code including a web reference to my HelloWorldWebService in my asp.net web form to utilise PageAsyncTask functionality. One thing I have noticed is that when I create an instance of the HelloWorldWebService web service, it does not display the BeginHelloWorldProcedure and EndHelloWorldProcedure methods and the only asynchronous method HelloWorldProcedureAsync is displayed My questions are: 1) why am not seeing BeginHelloWorldProcedure and EndHelloWorldProcedure methods ? 2)If I am supposed to use HelloWorldProcedureAsync method how does this supply the IAsyncResult which is the output of BeginEventHandlder part of the input of PageAsyncTask Any help will be appreciated. thanks. [WebService] public class HelloWorldWebService : System.Web.Services.WebService { public delegate string HelloWorldAsyncStub(); public string HelloWorldProcedure() { return "HelloWorld"; } public class MyState { public object previousState; public HelloWorldAsyncStub helloworldStubStub; } [System.Web.Services.WebMethod] public IAsyncResult BeginHelloWorldProcedure(AsyncCallback cb, object s) { HelloWorldAsyncStub stub = new HelloWorldAsyncStub(HelloWorldProcedure); MyState ms = new MyState(); ms.previousState = s; ms.helloworldStubStub = stub; return stub.BeginInvoke(cb, ms); } [System.Web.Services.WebMethod] public string EndHelloWorldProcedure(IAsyncResult call) { MyState ms = (MyState)call.AsyncState; return ms.helloworldStubStub.EndInvoke(call); } }

    V 1 Reply Last reply
    0
    • E ekynox

      Hi there, I have been looking into implementing Asynchronous programming model within my webservice and my asp.net web form. I have found a few good MSDN articles, [^], to achieve this but there is one thing I do not quite follow. My webservice code is as listed below. I add all the relevant code including a web reference to my HelloWorldWebService in my asp.net web form to utilise PageAsyncTask functionality. One thing I have noticed is that when I create an instance of the HelloWorldWebService web service, it does not display the BeginHelloWorldProcedure and EndHelloWorldProcedure methods and the only asynchronous method HelloWorldProcedureAsync is displayed My questions are: 1) why am not seeing BeginHelloWorldProcedure and EndHelloWorldProcedure methods ? 2)If I am supposed to use HelloWorldProcedureAsync method how does this supply the IAsyncResult which is the output of BeginEventHandlder part of the input of PageAsyncTask Any help will be appreciated. thanks. [WebService] public class HelloWorldWebService : System.Web.Services.WebService { public delegate string HelloWorldAsyncStub(); public string HelloWorldProcedure() { return "HelloWorld"; } public class MyState { public object previousState; public HelloWorldAsyncStub helloworldStubStub; } [System.Web.Services.WebMethod] public IAsyncResult BeginHelloWorldProcedure(AsyncCallback cb, object s) { HelloWorldAsyncStub stub = new HelloWorldAsyncStub(HelloWorldProcedure); MyState ms = new MyState(); ms.previousState = s; ms.helloworldStubStub = stub; return stub.BeginInvoke(cb, ms); } [System.Web.Services.WebMethod] public string EndHelloWorldProcedure(IAsyncResult call) { MyState ms = (MyState)call.AsyncState; return ms.helloworldStubStub.EndInvoke(call); } }

      V Offline
      V Offline
      Venkatesh Mookkan
      wrote on last edited by
      #2

      Hi Ekynox,

      ekynox wrote:

      1. why am not seeing BeginHelloWorldProcedure and EndHelloWorldProcedure methods ?

      I used the above code created a WebSevice in VB (as Language does not matter). And I am able to see the Begin and End of the Web method in my website where I implemented. Could you please tell me how you implemented it in your application?

      [Venkatesh Mookkan] My: Website | Yahoo Group | Blog Spot

      E 1 Reply Last reply
      0
      • V Venkatesh Mookkan

        Hi Ekynox,

        ekynox wrote:

        1. why am not seeing BeginHelloWorldProcedure and EndHelloWorldProcedure methods ?

        I used the above code created a WebSevice in VB (as Language does not matter). And I am able to see the Begin and End of the Web method in my website where I implemented. Could you please tell me how you implemented it in your application?

        [Venkatesh Mookkan] My: Website | Yahoo Group | Blog Spot

        E Offline
        E Offline
        ekynox
        wrote on last edited by
        #3

        Hi there, Thanks for the response. I actually worked out why I was not seeing the BeginXXX/EndXXX methods. When I complied the code under VS 2005, the compiler will automatically generate the BeginXXX/EndXXX methods of each web method found in your webservice. However, if you use VS 2008 .NET3.5 based web service the BeginXXX/EndXXX methods for each web method is not generated even if you explicitly state your BeginXXX/EndXXX methods it still wont be shown under VS 2008 .NET3.5. It would be interesting to findout why under VS 2008 and .NET 3.5 does this happen. In order to work around this I have decided not to bother with PageAsyncTask and just use the Async version of my web method. cheers

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups