I am making synchronous web service calls in my application, there are scenario where user requires to stop the execution of web service call in between i.e before response is returned .
Does any one has an idea how to stop a web service call in middle.
Asynchronous call generally denotes background processing and letting the foreground flow continue. Is that the intention here ? Not very sure if this would be the solution.
Make WS call in a separate thread and along with that start a parallel timer thread. Mention the time in the timer thread (using sleep or join methods). If you do not get the response in time, then stop the WS invoker thread and pop a message to the user.
Note : If user still says I am OK to wait for the response, above solution has to be tweaked. This solution will stop the WS invoker thread alltogether and the response would always be ignored.
posted 10 years ago
Waswani Naresh wrote:Asynchronous call generally denotes background processing and letting the foreground flow continue. Is that the intention here ? Not very sure if this would be the solution.
Asynchronous client, not server.
Make WS call in a separate thread and along with that start a parallel timer thread.
This is exactly what I meant when suggesting an asynchronous client. The advantage is that you do not have to start a thread yourself. When generating client artifacts using wsimport, you need to supply a binding file in which you set <enableAsyncMapping>true</enableAsyncMapping>, in order to get asynchronous client methods.
for changing synchronous WS to asynchronous WS i would be changing my complete application(around 100 web services) ...........
so suggest something in context with sysnchronous WS,
i have thought , when we make a wS call a thread is created between java and server(where services lie) , if i can get hold of that thread then i can truncate it .
I checked on response object in eclipse ide , i was getting prompted for only to 2 threading methods notify and wait (sort of confirming my doubt that we dont have the access to truncate ws call once started)