Silverlight 4.0问题-同步调用asmx web服务
我有 Silverlight 问题。
我必须处理相当大的遗留应用程序,其中暴露了一些Web服务(常规asmx,而不是wcf)。我需要做的是构建使用这些 Web 服务的 Silverlight 应用程序。由于业务逻辑,我需要从 Silverlight 应用程序同步调用相同的 Web 方法。我能够构建 Web 服务消费,但只能异步进行,因为这将是默认的 Silverlight 行为。
Silverlight中有没有办法使异步调用同步?我看了这里并用谷歌搜索,但只找到了 wcf 示例。如果有人能给我一个常规 asmx Web 服务的代码示例,我将不胜感激。我使用Silverlight 4.0。
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Silverlight 不支持同步调用。甚至 TCP/IP 堆栈也是异步的。
在某些情况下,您需要将“WebServiceCall-A”的结果发送到“WebServiceCall-B”,您将必须编写代码将它们链接在一起。例如,webservice-call-a ->回调-a->处理数据->网络服务-b ->回调-b ->处理数据-> ETC。
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.
仅供参考:
我今天找到了 Daniel Vaughan 的文章。这是链接:
http://www.codeproject.com/KB/silverlight/SynchronousSilverlight。 aspx
它解释了如何使用 Silverlight 进行同步 Web 服务调用。
Just FYI:
I have found the article by Daniel Vaughan today. Here is the link:
http://www.codeproject.com/KB/silverlight/SynchronousSilverlight.aspx
It explains how you can actually do Synchronous Web Service Calls with Silverlight.