473,289 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Can a Web Servive send it's status to a client?

Hi,
I have a web service which is doing a lot of processing and taking 4-5
minutes to do so. The processing is split into several discrete steps and I
would like for the service to be able to tell the client when it is done
with each step.
I have tried to do this in a couple of ways and neither have worked. Any
ideas how I might get it to work?

What I have tried was:

1) Splitting out each processing step into a different web method and then
having the client call each method as the one before it finished.
The sort of work, in that the client knew what was happening when,
but the I could not get the service to remember the intermediate results and
thus it did everything after the first step on null objects. I thought of
passing the results back to the client and then having it pass them back to
the service, but there is too much data in the intermediate results for that
to be reasonable.

2) Having the WebService class have a private status string and a public
WebMethod GetStatus which returns that string. The service then updates the
string as appropriate and the client asks for it periodically.
The value of the status string never actually changed. I wrote code
(C#):
status = "Starting Blast analysis.";
BlastSolutionSet thisSolution =
DatabaseAccess.GetExperiment(experimentGuid);
thisSolution.BlastAll();
status = "Collating Blast Data";
thisSolution.AssignBlastResults();
status = "Querying NCBI";
thisSolution.CollectNcbiData();
status = "Done";
In debug mode, the value of status was always "".
Ay thoughts?
Thanks!
Ethan

Jan 29 '07 #1
9 1759
No.
"Ethan Strauss" <ethan dot strauss at Promega dot comwrote in message
news:uW*************@TK2MSFTNGP05.phx.gbl...
Hi,
I have a web service which is doing a lot of processing and taking 4-5
minutes to do so. The processing is split into several discrete steps and
I
would like for the service to be able to tell the client when it is done
with each step.
I have tried to do this in a couple of ways and neither have worked.
Any
ideas how I might get it to work?

What I have tried was:

1) Splitting out each processing step into a different web method and then
having the client call each method as the one before it finished.
The sort of work, in that the client knew what was happening when,
but the I could not get the service to remember the intermediate results
and
thus it did everything after the first step on null objects. I thought of
passing the results back to the client and then having it pass them back
to
the service, but there is too much data in the intermediate results for
that
to be reasonable.

2) Having the WebService class have a private status string and a public
WebMethod GetStatus which returns that string. The service then updates
the
string as appropriate and the client asks for it periodically.
The value of the status string never actually changed. I wrote code
(C#):
status = "Starting Blast analysis.";
BlastSolutionSet thisSolution =
DatabaseAccess.GetExperiment(experimentGuid);
thisSolution.BlastAll();
status = "Collating Blast Data";
thisSolution.AssignBlastResults();
status = "Querying NCBI";
thisSolution.CollectNcbiData();
status = "Done";
In debug mode, the value of status was always "".
Ay thoughts?
Thanks!
Ethan

Jan 29 '07 #2
"Ethan Strauss" <ethan dot strauss at Promega dot comwrote in message
news:uW*************@TK2MSFTNGP05.phx.gbl...
I would like for the service to be able to tell the client when it is done
with each step.
I don't believe this is possible due to the disconnected nature of the
WebRequest / WebResponse architecture ...
Jan 30 '07 #3
I have a web service which is doing a lot of processing and taking 4-5
minutes to do so. The processing is split into several discrete steps and
I
would like for the service to be able to tell the client when it is done
with each step.
I have tried to do this in a couple of ways and neither have worked.
Any
ideas how I might get it to work?

Use one service to start the process
And another service to query the status.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Jan 30 '07 #4
The only solution would be to use async web service calls from your client,
probably using threads in your client. The concept is certainly well
documented on google.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"Ethan Strauss" <ethan dot strauss at Promega dot comwrote in message
news:uW*************@TK2MSFTNGP05.phx.gbl...
Hi,
I have a web service which is doing a lot of processing and taking 4-5
minutes to do so. The processing is split into several discrete steps and
I
would like for the service to be able to tell the client when it is done
with each step.
I have tried to do this in a couple of ways and neither have worked.
Any
ideas how I might get it to work?

What I have tried was:

1) Splitting out each processing step into a different web method and then
having the client call each method as the one before it finished.
The sort of work, in that the client knew what was happening when,
but the I could not get the service to remember the intermediate results
and
thus it did everything after the first step on null objects. I thought of
passing the results back to the client and then having it pass them back
to
the service, but there is too much data in the intermediate results for
that
to be reasonable.

2) Having the WebService class have a private status string and a public
WebMethod GetStatus which returns that string. The service then updates
the
string as appropriate and the client asks for it periodically.
The value of the status string never actually changed. I wrote code
(C#):
status = "Starting Blast analysis.";
BlastSolutionSet thisSolution =
DatabaseAccess.GetExperiment(experimentGuid);
thisSolution.BlastAll();
status = "Collating Blast Data";
thisSolution.AssignBlastResults();
status = "Querying NCBI";
thisSolution.CollectNcbiData();
status = "Done";
In debug mode, the value of status was always "".
Ay thoughts?
Thanks!
Ethan

Jan 30 '07 #5
What I would do in this case - to "keep it simple" is have a GetCurrentStatus
WebMethod that you can poll on a timer from the client. You could either
return a percentcomplete number, or an enum that represents the current state
of the "job". Since ASP.NET WebServices have access to all the ASP.NET
infrastructure, you can use session, Global.asax, etc. for state storage on a
per-session basis. Probably you would not want to try to use ASP.NET Session,
instead a GUID representing the current "job" being a key into a hashtable of
"JobState" objects.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Ethan Strauss" wrote:
Hi,
I have a web service which is doing a lot of processing and taking 4-5
minutes to do so. The processing is split into several discrete steps and I
would like for the service to be able to tell the client when it is done
with each step.
I have tried to do this in a couple of ways and neither have worked. Any
ideas how I might get it to work?

What I have tried was:

1) Splitting out each processing step into a different web method and then
having the client call each method as the one before it finished.
The sort of work, in that the client knew what was happening when,
but the I could not get the service to remember the intermediate results and
thus it did everything after the first step on null objects. I thought of
passing the results back to the client and then having it pass them back to
the service, but there is too much data in the intermediate results for that
to be reasonable.

2) Having the WebService class have a private status string and a public
WebMethod GetStatus which returns that string. The service then updates the
string as appropriate and the client asks for it periodically.
The value of the status string never actually changed. I wrote code
(C#):
status = "Starting Blast analysis.";
BlastSolutionSet thisSolution =
DatabaseAccess.GetExperiment(experimentGuid);
thisSolution.BlastAll();
status = "Collating Blast Data";
thisSolution.AssignBlastResults();
status = "Querying NCBI";
thisSolution.CollectNcbiData();
status = "Done";
In debug mode, the value of status was always "".
Ay thoughts?
Thanks!
Ethan

Jan 30 '07 #6
Thanks to everyone who responded.
At this point I have more or less given up on this. It would have been nice,
but
it isn't needed. FWIW, I am running an ansynchronous service with another
web method which is GetStatus(). That didn't work :-(
I considered having the service write the status to a database and have the
client poll the database periodically, but decided that was more overhead
than it was worth.
I hope to have more time to look into this because I am sure it will come up
again for me.
Ethan

"Ethan Strauss" <ethan dot strauss at Promega dot comwrote in message
news:uW*************@TK2MSFTNGP05.phx.gbl...
Hi,
I have a web service which is doing a lot of processing and taking 4-5
minutes to do so. The processing is split into several discrete steps and
I
would like for the service to be able to tell the client when it is done
with each step.
I have tried to do this in a couple of ways and neither have worked.
Any
ideas how I might get it to work?

What I have tried was:

1) Splitting out each processing step into a different web method and then
having the client call each method as the one before it finished.
The sort of work, in that the client knew what was happening when,
but the I could not get the service to remember the intermediate results
and
thus it did everything after the first step on null objects. I thought of
passing the results back to the client and then having it pass them back
to
the service, but there is too much data in the intermediate results for
that
to be reasonable.

2) Having the WebService class have a private status string and a public
WebMethod GetStatus which returns that string. The service then updates
the
string as appropriate and the client asks for it periodically.
The value of the status string never actually changed. I wrote code
(C#):
status = "Starting Blast analysis.";
BlastSolutionSet thisSolution =
DatabaseAccess.GetExperiment(experimentGuid);
thisSolution.BlastAll();
status = "Collating Blast Data";
thisSolution.AssignBlastResults();
status = "Querying NCBI";
thisSolution.CollectNcbiData();
status = "Done";
In debug mode, the value of status was always "".
Ay thoughts?
Thanks!
Ethan

Feb 1 '07 #7
it isn't needed. FWIW, I am running an ansynchronous service with another
web method which is GetStatus(). That didn't work :-(
My personal suggestion.... avoid async service-calls as much as possible.

They are more pain practically than theoretically.
I considered having the service write the status to a database and have
the client poll the database periodically, but decided that was more
overhead than it was worth.
Well, instead of putting in database, you may want to cache it.

A simple solution may be something like this:

1. StartService (web service to start) returns a simple string - may be a
GUID
2. QueryStatus takes this GUID as a parameter and returns a simple %age on
completion.

Now, the %age completion doesn't need to be in database. You may very well
put it in server-cache whose key is this GUID.

That should do.

Keep in mind that it would fail in the case of web-farm deployment since the
cache would not be in session-server but on the same machine as in
ASP.Net... I hope I am wrong.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Feb 6 '07 #8
My personal suggestion.... avoid async service-calls as much as possible.
You need to explain this or at least qualify the statement. Async calls are
there for a reason, when you go against the grain, you need to provide
justification to support your position.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"MasterGaurav (www.edujini-labs.com)" <ga*****************@nospam.gmail.com>
wrote in message news:Oi*************@TK2MSFTNGP06.phx.gbl...
>it isn't needed. FWIW, I am running an ansynchronous service with another
web method which is GetStatus(). That didn't work :-(
zMy personal suggestion.... avoid async service-calls as much as possible.
>
They are more pain practically than theoretically.
>I considered having the service write the status to a database and have
the client poll the database periodically, but decided that was more
overhead than it was worth.

Well, instead of putting in database, you may want to cache it.

A simple solution may be something like this:

1. StartService (web service to start) returns a simple string - may be a
GUID
2. QueryStatus takes this GUID as a parameter and returns a simple %age on
completion.

Now, the %age completion doesn't need to be in database. You may very well
put it in server-cache whose key is this GUID.

That should do.

Keep in mind that it would fail in the case of web-farm deployment since
the cache would not be in session-server but on the same machine as in
ASP.Net... I hope I am wrong.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------


Feb 11 '07 #9
>My personal suggestion.... avoid async service-calls as much as possible.
You need to explain this or at least qualify the statement. Async calls
are there for a reason, when you go against the grain, you need to provide
justification to support your position.
In practice, what I have noticed is that is the response time is on the
higher side, one tends towards timeouts.

AFAIK, the main reason behind async-calls is to be able to monitor or at
least not get into a situation where application stops responding.

If any method is taking a long time for execution, I have always found it
better to go for regular check (periodic check for the progress). Yes, it
does consume a little bit of bandwidth but may be better otherwise.

For timeouts, we have various nodes:

1. Execution time of the service (ASP.Net configuration)
2. Response from the execution (IIS Configuration)
3. Firewall / Proxy configuration
4. Client configuration -- client may have its own timeout

I do agree that in terms of bandwidth utilization, async-calls may be
better. But then, there are various nodes that may need configuration
otherwise... like probably 4 of them as mentioned above.

On how many of them do we have a control may be a question to ask.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Feb 11 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Steve Horrillo | last post by:
I can't figure out why this script won't insert the subject in the email and why can't I control the font and size being used? I'm not sure where to post this. Let me know where if this is OT. ...
2
by: Danny J. Lesandrini | last post by:
Our orders database exists inside our firewall but we have a web site hosted on an ISP server. If we wanted to give users the ability to query the status of their order in real time, we could just...
1
by: michi | last post by:
Hi there.... Got here a tricky thing with my SMTP. First I show you what works on my machine.. **This Works** SmtpMail.SmtpServer = "mail.gmx.net" <-gmx is my mail provider...
2
by: inferno2000 | last post by:
Let's say if I want to send a http "Post" request to a url, and check the http status code later. How should I write the code? I have found example to use WinHttp to send "Get" request and check...
2
by: yvan | last post by:
Hi, Here is my client/server scenario: Step1: Client connects to server and sends data sucessfully (using Socket.Send()). Step2: Server gracefully exists (calls Socket.Shutdown() and...
2
by: Ethan Strauss | last post by:
Hi, I have a web service which is doing a lot of processing and taking 4-5 minutes to do so. The processing is split into several discrete steps and I would like for the service to be able to tell...
4
by: dols | last post by:
Hello, below the fragment that works fine, but nevertheless, the value of xmlhttp.status turns out to be zero (0), and the corresponding value for xmlhttp.statusText is "unknown". Does anyone...
3
by: unclesteve | last post by:
I am working on a project for a law firm where the different files are either boxed or unboxed. Unboxed files can be on a lawyer's desk, on the secretary's desk, or on a shelf in the back room. A...
7
by: Anil | last post by:
I have a Javascript program which runs in the browser and has functions work(), and stop(). It listens to commands from the server to work() and can be interrupted by the server to stop(). I am...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.