none
Calling a Service Refernce Async RRS feed

  • Question

  • I am running in circles trying to call this web service with the async method.  I am using VB.NET (C# examples are fine), and the reference is made to a web service under web References.  I create a variable of type [web reference].Service.  When I do this I can see the method calls and also the method calls with async.  So if there is a method called Getsites([arg1],[arg2]) I also see GetSitesAsync([arg1],[arg2]) and overloaded with GetSitesAsync([arg1],[arg2],userState as Object). 

    A call to the non async works just fine.  It returns a string from the method without a problem.  But I am now trying to call this method with the async and I just can't get it to work.

    Code:

    Dim x as net wsTest.Service 'call to the web service

    Dim y as wsTest.Serivce.Role() 'collection of strings

    y = x.getRole([param1],[param2], "")

    Y contains the role data.  How do I do this call:

    y = x.getRoleAsync([param1],[param2],"",[I don't know what goes here for the userState)

    I would like to spin this off onto it's own thread because this call does take a while to return.  I am using vs 2013 so if there is a way to async wait that would be great.

    All help is so much appreciated. I am trying to wrap my head around the async and would really like to make these changes to help with longer processes.

    Thursday, November 6, 2014 5:31 PM

Answers

  • Hi,

    Asynchronous web services call in ASP.NET:

    http://www.codeproject.com/Articles/600926/Asynchronous-web-services-call-in-ASP-NET 

    http://sravi-kiran.blogspot.com/2012/10/CallingWcfServicesAsynchronouslyUsingAsyncAndAwait.html

    http://robbincremers.me/2011/12/31/wcf-asynchronous-client-proxy-and-asynchronous-service-operations/ 

    • Marked as answer by katghoti Monday, November 10, 2014 4:06 PM
    Friday, November 7, 2014 8:27 AM