In integration with an existing application with new functionality, I am looking for a way to accomplish the following:
- Existing application passes in a parameter (can assume it’s a pair of coordionates, latitude/longitude)
- New functionality interprets the parameter, and runs a web service method (which is also accessible from the existing application, but this shouldn’t be relevant)
- After the response returns from the web service, invoke a graphical representation of the response (also can assume it’s a coordionate pair), and display it on a map (Bing maps)
The part where I’m stuck on is the waiting for the response programmatically from the web service.
-
Should I simply be calling the web service from the existing application? There still is the problem of having to wait for the response before I can do further processing.
-
Or is there a way to ‘wait’ for the response from the web service that I can apply via JS/ASP.NET?
Keeping in mind although a possible solution is to add an user interaction step (click this button to continue after the web service returns a result) it’s undesirable and I would like to keep this to a single user interaction if possible.
You will want to research ASP.NET’s AJAX functionality. I’m not sure how ASP.NET treats AJAX calls without having an environment or reference documentation in front of me, but the general pattern for AJAX calls is:
You can cause the client to ‘wait’ for the response using the ‘synchronous’ flag, but this is not recommended, since it causes the browser to freeze up until the response is returned by the server.
If you need something more sophisticated than this, you may have to dig into web sockets:
http://www.html5rocks.com/en/tutorials/websockets/basics/