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. General Programming
  3. C#
  4. how to make multiple asynchronous web service method calls in the same thread? [modified]

how to make multiple asynchronous web service method calls in the same thread? [modified]

Scheduled Pinned Locked Moved C#
helptutorialquestion
2 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.
  • J Offline
    J Offline
    JUNEYT
    wrote on last edited by
    #1

    Hi, I would like to know how to make multiple asynchronous web service method calls in the same thread? What if the web service method cannot be checked by IAsyncResult status operation statement but just invoking the MethodNameAsync(X,Y,Z). What I think is sleeping the thread shouldn't be the way to handle it because lets assume that 20 of form controls inside the form uses web methods to populate themselves and one of the control's value is used as an argument to call another asynchronous method to populate another control in the form . The problem is I have a few asynchronous call in the same thread and I couldn't figure it out how to create waits between the each asynchronous calls until it gets loaded completely. Is there a way to load all asynchronous methods before the form loads. if you enlighten me about the solution, I would really appreciate it. This is my first Web Service client issue to solve and I have no experience about it. Thanks.

    What a curious mind needs to discover knowledge is noting else than a pin-hole.

    modified on Tuesday, May 24, 2011 9:28 AM

    M 1 Reply Last reply
    0
    • J JUNEYT

      Hi, I would like to know how to make multiple asynchronous web service method calls in the same thread? What if the web service method cannot be checked by IAsyncResult status operation statement but just invoking the MethodNameAsync(X,Y,Z). What I think is sleeping the thread shouldn't be the way to handle it because lets assume that 20 of form controls inside the form uses web methods to populate themselves and one of the control's value is used as an argument to call another asynchronous method to populate another control in the form . The problem is I have a few asynchronous call in the same thread and I couldn't figure it out how to create waits between the each asynchronous calls until it gets loaded completely. Is there a way to load all asynchronous methods before the form loads. if you enlighten me about the solution, I would really appreciate it. This is my first Web Service client issue to solve and I have no experience about it. Thanks.

      What a curious mind needs to discover knowledge is noting else than a pin-hole.

      modified on Tuesday, May 24, 2011 9:28 AM

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      JUNEYT wrote:

      Is there a way to load all asynchronous methods before the form loads.

      If the calls are truly asynchronous then there should be some notification of completion (like an event). I use something similar to the DomainContextLoadBatch class found in this article[^]. This class lets you queue up a bunch of asynchronous calls and doesn't notify you until they have all completed. The class as shown is for WCF RIA Services LoadOperation calls, but could easily be modified for other webservice call types. *edit* If you use that class as a guide, please note that as shown the class is NOT thread safe, so if your webservice calls can complete on other threads you'll need to make sure at least the class' single completion handler is thread safe. You shouldn't have to sleep and wait...that negates the whole purpose of asynchronous calls...

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      modified on Tuesday, May 24, 2011 12:03 PM

      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