Web Page & WebService Threading Example

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I have a Web page which calls a WebService, this web service call might take
few seconds to up 30 min
I was thinking of having a webpage query the webservice every minute to keep
it form timing out, but I am not sure how to do that,
somehow I have to have the webpage query the status of the Webservice
request every minute or so to keep it from timing out.

I was thinking to do the following:

1) Web page calls a webservice
2) A web service spans a thread and returns some thread id to the calling
webpage
3) The web page keeps calling the webservice with this thread id every
minute as long as the webservice confirms the thread is running, that way
the web page will not timeout
4) Once the thread is completed the web page calls the webservice again and
retrieves the final result.

Does anyone has an example of such process or a better idea of how this
should be done?


Thank you


Peter
 
The process creates reports so depending on what data you are querying
depends how long you wait.

For instance every day the user enters 'Smith' as the parameter and looks
for results, the report might take 5 seconds to run to display the data.
Then one day the user enters 'S*' and the report takes 20 minutes to run so
I can't tell the user to expect email sometimes and display it on the screen
other times specialy when the users want to see the results on the screen.
 
That's what was saying in steps 1 thrugh 4, I just wondering if there's an
example or if someone has a better idea.
 
Hi Peter,

From your description, what you want to do is implement an async pattern
for calling a long run webservice method from an ASP.NET web application.

Yes, I think the pattern you mentioned is workable. Your current idea is
make the async processing tracking (and status management) at the
webservice side. the client calling web application will pull the status
and result by keep calling webmethod from that webservice, correct?

Here is an MSDN article mentioned another pattern for processing such
long-run task in async mode:

#How To: Submit and Poll for Long-Running Tasks
http://msdn2.microsoft.com/en-us/library/ms979200.aspx

the idea in it is put all the async call and status polling(and management)
at client calliing side(asp.net application). You use the auto-generated
async webmethod (beginXXX and endXXX) to call the webservice asynchornouly
and use the callback handler to update status table. Also, you need a
polling page to constantly poll the status table to check whether a certain
task has finished. The advantage here is that it doesn't require your
server-side webservice to change much.

BTW, since your webservice execute long-run task, you may need to adjust
the timeout setting (for both server-side ASP.NET webservice application)
and the client-side webservice proxy so as to avoid timeout exception. Here
is a former thread where I've mentioned the related timeout settings:

#Timeout Calling Web Service
http://bytes.com/forum/thread425416.html

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 
Back
Top