Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

How to call SOAP based web services asynchronously.

$
0
0

Hi Folks,

I have three different webservices method calling one after another.  The first web method provides data to second  and then second web method provide data to the third 

Here is code my code snippet

 public IActionResult OnPostSubmitImpNotice(int id)
        {
            try
            {

                // --> this works fine 
                SubmitRequestStatus submittedRequest = rayah.SendTanfeedh(ImpNotice.IDNo, ImpNotice.Receiver, ImpNotice.Stage, ImpNotice.NumberOfDays.ToString(), ImpNotice.Sender, ImpNotice.Extension.ToString(), TanfeedhFilePath);
                    ImpNotice.BatchNumber = submittedRequest.BatchNumber;
                    if (submittedRequest.Status=="1")
                    {
                        // -> This method takes a little bit time.

                       StatusResponse SentMessageStatus = rayah.GetStatus(submittedRequest.BatchNumber);
                       ImpNotice.BatchIdentifier = SentMessageStatus.BatchIdentifier;
                               if (SentMessageStatus.Status=="0")
                               {
                                     / --> this works fine 
                                  DetailedStatus detailedStatus=rayah.GetDetailedStatus(SentMessageStatus.BatchIdentifier);
                                  if(detailedStatus.Status=="0")
                                  {
                                       //....
                                  }
                               }
                    }
                return RedirectToPage("/Secure/Operations/Index");
            }
            catch (Exception)
            {

                throw;
            }

my problem is the second web method  takes a little more time to get the value.... before it can be passed to the third .....

One way to solve problem is to put a while loop  and keep checking until I get the response but I don't think this is a ideal solution as in that case my screen will freeze until the method completes his job....  my question is how I can transform this service to using Async Call?  

 


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>