Greetings all
Could u kindly help me to explain the difference please?
When and how to use the function with Async?
Greetings all
Could u kindly help me to explain the difference please?
When and how to use the function with Async?
Are you using C# with WCF?
If my understand is correct, original WSDL does not have method GetInflightStatusAsync. I think the method was generate by WCF. You can open WSDL file with SOAP UI to see original SOAP methods provided by TRTH service.
Normally if you add WCF Service Reference, .NET automatically generate method end with Async keyword for using with Async/Await feature (asynchronous call). It could help in many case for example when calling the method in UI/Web interface and it take long time to get the result. Please find more details about Async/Await from MSDN.
However if you want to try the method the following small console example codes might help.
class Program { static void Main(string[] args) { try { System.Console.WriteLine("Get Inflight Status..."); var T = GetInflight(); T.Wait(); System.Console.WriteLine("Inflight Active/Limit={0}/{1}", T.Result.status.active, T.Result.status.limit); } catch (Exception e) { System.Console.WriteLine("Exception: {0}", e.Message); } } static async Task<TRTHService.GetInflightStatusResponse> GetInflight() { TRTHService.TRTHApiClient client = new TRTHService.TRTHApiClient(); TRTHService.CredentialsHeader cred = new TRTHService.CredentialsHeader() { username = "<Username>", password = "<Password>" }; client.CleanUp(ref cred); return await client.GetInflightStatusAsync(cred); } } Output Get Inflight Status... Inflight Active/Limit=0/50 Press any key to continue . . .