none
Calling WCF Async help RRS feed

  • Question

  • I have a 2013 VB app that I have inherited and need to update it very, very badly.  I am stuck with the WCF services that the product calls and cannot change them.  I do make references to them and I do see that each method on the service has both a sync call and an async call method.  For example there is a method called sites that returns an array of strings.  My local instance has both the objWCF.Sites and objWCF.SitesAsync.  Each take in a string as a parameter and the async method includes an extra parameter called UserState as Object.

    In the code, it only calls the site method as such

    Dim returnstg as string() = objWCF.Sites("test")

    This fills the returnstg with 0 to N strings.  The problem is this can take a few minutes because the strings are retrieved (up to 5 minutes) and then processed in another function (1-2 minutes).  So the user is sitting up to 7 minutes waiting.  This can seem like forever.  I would like to call the async method and return control to the user to continue to use the program.  How do I do this?  I am familiar with call backs (addressOf, etc), but a little help would be great.  When I call the async method:

    Dim rtnStg as string() = objWCF.SitesAsync.Sites("test",[what goes here?])

    How is this done? Do I create a delegate and InvokeAsync method for the Sites call? 

    Any help is appreciated.

    Wednesday, November 5, 2014 8:00 PM

Answers

All replies

  • I don't remember seeing a question about WCF in this forum before. Perhaps you will receive a response to assist you with your question but I'm not sure.

    I know there's a forum for WCF at Windows Communication Foundation, Serialization and Networking but I've never looked at any threads in it till now. And I don't know if that may be where you would want to post a question since your app is VB.Net but the question is related to WCF.

    On the other hand the WPF forum, specific to creating WPF applications, it seems to me is for any programming language which is kind of strange. Although if a WPF question appears in this forum and I can answer it after research I respond to it as well as providing the link for the WPF forum.


    La vida loca

    Wednesday, November 5, 2014 8:27 PM
  • I put it here because  I am developing a windows forms app against WCF services that reside on the server.  I am more interested in how I would call the services via async methods so I can pass control back to the program while doing long operations.  The WCF already exists, and I do see the async methods created for the object in my dropdown.  I just don't know how I would use them from a windows form app. If you think it should go elsewhere, I can move it there if you want.

    Wednesday, November 5, 2014 10:48 PM
  • I put it here because  I am developing a windows forms app against WCF services that reside on the server.  I am more interested in how I would call the services via async methods so I can pass control back to the program while doing long operations.  The WCF already exists, and I do see the async methods created for the object in my dropdown.  I just don't know how I would use them from a windows form app. If you think it should go elsewhere, I can move it there if you want.

    Walkthrough: Creating and Accessing WCF Services

    How to: Call WCF Service Operations Asynchronously


    La vida loca

    Thursday, November 6, 2014 1:12 AM
  • I put it here because  I am developing a windows forms app against WCF services that reside on the server.  I am more interested in how I would call the services via async methods so I can pass control back to the program while doing long operations.  The WCF already exists, and I do see the async methods created for the object in my dropdown.  I just don't know how I would use them from a windows form app. If you think it should go elsewhere, I can move it there if you want.

    That's where you should post is to the WCF forum. They will help you there. You don't think there is someone in that forum that has done the same thing you are trying to do? There are some very knowledgeable people in that forum.

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wcf

    Thursday, November 6, 2014 3:31 AM