Skip to main content

Answered Question Calling Web Services SynchronouslyRSS Feed

(0)

crpietschmann
crpietsc...

Member

Member

217 points

57 Posts

Calling Web Services Synchronously

It's a real bummer that you can't call web services synchronously in Silverlight. At least the functionality isn't baked in like it should be. Why limit us!

Could people post their suggestions on their best methods for accessing Web Services Synchronously in Silverlight here?

Microsoft MVP - Windows Live Platform
Blog: http://pietschsoft.com | Web.Maps.VE - ASP.NET AJAX Bing Maps Control

HarshBardhan
HarshBar...

Star

Star

9908 points

1,719 Posts

Answered Question

Re: Calling Web Services Synchronously

Hi,

You can write your logic which you want to execute after Webservice call completion in Completed event of your Web service call so that your call to service will be completed.

You can use a dispatcher timer also and after certain duration  you can check a flag(which you will set in web service call completed handler) and accordint to that you can execute your code..

Mark as answer if this post answered your question.

Harsh Bardhan

Kevmeister
Kevmeister

Member

Member

249 points

121 Posts

Answered Question

Re: Calling Web Services Synchronously

Sorry, Chris, this topic has been done to death several times now and its almost guaranteed to be flamebait. Search for (for example):

  • Petition for return of synchronous web services (this one turned into a flame war and looks like it may have been deleted).
  • Design (As in Architecture) Strategies for dealing with async web services
  • Working with Async web services and WebRequest/WebClient (DISCUSSION THREAD)
  • Lack of synchronous server requests

The main point is that it looks like synchronous behaviour was removed on account of not being supported by all browsers. I'd certainly like to see it returned, but the reality at present is that if you live with that hope, you'll get nothing done.

Instead you need to alter your implementation practices to allow for async. Depending on the job at hand there are a number of different strategies available to get the job done, but be warned that none are as simple as the synchronous option would have been, despite what some people tried to argue.

 

 

pbromberg
pbromberg

Contributor

Contributor

2312 points

397 Posts

Re: Calling Web Services Synchronously

In order to be cross-browser, Silverlight needs to implement the NPAPI plugin model which only provides for asynchronous calls. It's not hard to learn to use.

Kevmeister
Kevmeister

Member

Member

249 points

121 Posts

Re: Calling Web Services Synchronously

pbromberg:
... implement the NPAPI plugin model...

In case you go searching for this, the correct acronym is in fact NBAPI, for Netscape Browser API.

ccoombs
ccoombs

Contributor

Contributor

6068 points

878 Posts

Re: Re: Calling Web Services Synchronously

 NPAPI is correct.  Netscape Plugin API.

http://en.wikipedia.org/wiki/NPAPI

jackbond
jackbond

Contributor

Contributor

2894 points

742 Posts

Re: Calling Web Services Synchronously

Microsoft could use the underlying operating system's native network stack instead of the plugin APIs. Using this approach would have benefits beyond synchronous calls, one being a more robust Soap implementation. Short of that, the only currently work around is to use the native XmlHttpRequest, more details here, http://silverlight.net/forums/t/11508.aspx

razanpaul
razanpaul

Member

Member

10 points

5 Posts

Re: Calling Web Services Synchronously

You can take a look at http://weblogs.asp.net/razan/archive/2010/01/14/emulating-synchronous-web-service-call-in-silverlight.aspx

  • Unanswered Question
  • Answered Question
  • Announcement