Friday 15 January 2010

c# - Can't get async method that calls WCF service to work - async newbie -


I need to check the async call for an external SOAP service. I have a main program that is available for web service (This will eventually become a Windows service, but will simplify it for debugging purposes). In the main program, the service is called multiple times from within the loop. I need to create a SOAP request dynamically, so I have a class that does this and within that class I have an async method that looks like this:

  public Async Tasks & lt; WebServiceResponse & gt; ExecuteWebService () {var request = BuildRequest (); // non-async: Creates dynamic SOAP requests Retrieve var DataClient = new external form provider interface client (); RetrieveDataClient.Open (); Wait for return DataClient.RetrieveDataAsync (request); }  

My problem is this: When I debug the above method, it comes back as soon as the external client constructor (second line) is called. The Open () method is never called and the actual SOAP call is never done.

I am new to ASCNC programming ... someone can show me where I have found the wrong and tell me why this method first comes back to the return statement?

My stupid I ran SvcUtil on a service that had already provided the interface client. This creates a local copy of the customer when I executed the constructor, it was confusing between the two. The local copy of the interface client class was deleted and all is fine.


No comments:

Post a Comment