Showing posts with label complete. Show all posts
Showing posts with label complete. Show all posts

Monday, March 26, 2012

Design Question (Looking for your opinions)

I have a page that I need to call a method from my business tier. This method ussually will execute and complete quite quickly.

But because we are making and call to an external service. There are times where the network could be slow or the request gets sent but nothing comes back.

What I want to do is use ajax to make a call to the Business Layer. If it takes longer than say 5 secs. I want the ajax call to timeout and redirect to another page. Leaving

the process to complete on it's own (It doesn't return anything). The status of the "Async Job" will be checked somewhere else by the user.

Would this be an exceptable means of dealing with a long running task? We don't need the user to wait until it's complete.

Check out this for one example on long running queries...

http://www.west-wind.com/atlas/LongProgress/LongProgress.aspx

Maynot be exactly what you are looking for but...


That's a great example. Thank you very much.. I got it working :)

If I make the async call time out and call the function like so onTimeOut fires properly. If an error happens it goes to this method as well.

PageMethods.SendInfo(onComplete,onTimeOut);

If I make the async call error out OR time out and call the function like so PageMethods.SendInfo(onComplete,OnError,onTimeOut); both

timeouts & errors got the onError method.

Wednesday, March 21, 2012

Declarative timer and web service

I am trying to use a declarative script to timer on tick -> web service on complete -> update label.

No problems with updating the label but is there anyway to invoke a service method without resorting to javascript (i.e. pure xml-script)? I imagine I can do something like tick="Sys.Net.ServiceMethod.invoke(..." but it kinda kills the purpose.

Any ideas?

Alex

hello.

i think you're after the servicemethodrequest class.

here's an example of it's declaration:

<serviceMethod id="myService" url="webservice.asmx" methodName="Test">
<completed>
<!--invoke your binding from here-->
</completed>
</serviceMethod>

btw, you can invoke the previous service by using the invokeMethod action (invoke is the name of the method exposed by servicemethod that let's you start the web service method execution).


Luis - yes I am after theServiceMethodRequest class except I would like to invoke the ws via a timer control (w/o resorting to using JS) on tick event:

<timer id="timer" interval="1000" enabled="true" tick="INVOKE WS"/
<serviceMethod id="svc..." url="service.asmx" methodName="GetSomething">
<completed> ...</completed>
</serviceMethod>

While I can write a JS function to invoke the method (and I have done this) I would like to create a version (more elegant) w/o any JS using declarative script. No point for me to use a combination of declarative script to do the binding and ws calls if I still have to write a JS function to call the ws on Tick, might as well do the bindings manually. Right now this is what I do but would be great if I can use the tick event to invoke a ws as well. Any ideas?

AO


hello.

how about something like this;

<timer ...>
<tick>
<invokeMethod target="svc..." method="invoke" />
</tick>
</timer>

if you need parameters, then add them as child element of the invokemethod element...


Thanks that was easy... wish there was an easy way to browse the Atlas library by class with Visual Studio. The documentation didn't make any mention of this (as far as I remember) and from briefly looking in the code I didn't find it.

Luis, thanks again!