views:

150

answers:

1

Hi,

I have Silverlight problem.

I have to deal with fairly large legacy application that has some web services exposed (regular asmx, not wcf). What I need to do is to build Silverlight app that consumes those web services. Due to business logic I need to have the same web method to be called from Silverlight app synchronously. I was able to build web services consumption but only asynchronously because that would be default Silverlight behavior.

Is there a way to make asynchronous calls synchronous in Silverlight? I looked here and googled around but came across only wcf examples. I would appreciate if somebody would get me a code example for regular asmx web service. I use Silverlight 4.0.

Thanks!

+3  A: 

Silverlight does not support sync calls. Even the TCP/IP stack is async.

In some cases where you need the results of "WebServiceCall-A" to send to "WebServiceCall-B", you will have to write code to chain those together. For example, webservice-call-a -> callback-a -> process data -> webservice-b -> callback-b -> process data -> etc.

Jeremiah Morrill
Thank you Jeremiah, I will think of that.
Anvar
Hey Jeremiah, I was able to chain the execution calls to the web service and simulate synchronous calls. Thanks for your respond again.
Anvar
Yeah its a little more verbose than sync, but its a necessary evil with Silverlight ;)
Jeremiah Morrill