Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm totally confused by the whole acynch process. Here is what I have and where I want to be.

 

...............

Code runs for a while in ASP.NET

....

Web service 1 is called

....

Web service 2 is called

....

Results of both calls are used to log something to a table

 

 

Where I want to be is this:

I want web service 1 to be started and then web service 2 to be started. Then i want to wait around for both of them to finish and then go to the results part.

 

I don't understand how I wait around for the results before continuing?

 

Any suggestions?

Wanna-Be C# Superstar
  • *Experts*
Posted

The call to the webservices should stop the code in the ASP.NET

application until a result is returned; I don't understand what

the problem is.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • Administrators
Posted

If you add a web reference to a web service .Net should also generate an Async wrapper round the call.

 

e.g. If the web ervice had a method Test you would also get a BeginTest / EndTest that can be used to call a web method asyncronously (sp?)

If you have a particular service in mind reply and I could suggest some code.

 

PS. Bucky - love your sig :D

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

  • *Experts*
Posted
I knew you would, PD, judging by your avatar. :)

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

I call both services asynch using the Begin method but this does not halt the execution of the code. And I thought that was the purpose of doing it asynch anyhow. The code that follows the two calls performs a function that updates an Oracle table with the results of the two web service calls. Therefore, I cannot have that code execute until the services have completed.

 

I did get a suggestion for what I would consider a work around:

 

Call both services using the Begin method with callbacks for each.

When the callbacks respond have each check the result of the other to see if it has responded yet. In this manner you can determine when the last of the two is complete. Then this would in turn call a function which contained the remainder of my code.

 

I consider this a work around because it entails me ripping out all of the code that used to sit below the web service calls in the same Sub and moving it to a Function and passing it all of the variables that would have been local to the original Sub.

 

There has to be a better way, I am just not seeing it. Someone enlighten me.

Wanna-Be C# Superstar

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...