积极答复者
请问 silverlight 如何不引用来访问 webservice?

问题
答案
-
你好,
如果一定要用asmx而且不想用生成的proxy的话,就必需自己构造SOAP消息了. 你可以用Fiddler看以下收发的SOAP消息然后自己构造,用HTTPWebRequest发送.
另外还有一种方法.我们知道Silverlight可以调用JavaScritp方法,而JavaScript能够直接调用Web Service (当然也要自己构造SOAP消息). 但是ScriptManager提供了让JavaScript调用asmx的支持,这样我们就不必自己构造SOAP消息了.参考:http://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Need a sample of a technique of Microsoft? Just check out CodeFx first! http://cfx.codeplex.com/- 已标记为答案 Allen Chen - MSFTModerator 2009年8月6日 8:49
全部回复
-
你好,
你可以用WCF或ASP.NET来做一个REST service的服务器端程序.然后Silverilght使用HttpWebRequest来进行相应的请求.服务器端可以自由返回你想要的数据.
http://msdn.microsoft.com/en-us/netframework/cc950529.aspx
http://www.codeproject.com/KB/aspnet/RestServicesInASPNET2.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Need a sample of a technique of Microsoft? Just check out CodeFx first! http://cfx.codeplex.com/ -
你好,
哦,谢了! 不过由于现在我这是个是公司的项目,项目已在使用webservice做了不少底层开发了,所以不方便再转WCF或者其他的service了,不知有没其他方法呢? 主要是与Webservice(asmx)进行交互的
你可以用WCF或ASP.NET来做一个REST service的服务器端程序.然后Silverilght使用HttpWebRequest来进行相应的请求.服务器端可以自由返回你想要的数据.
http://msdn.microsoft.com/en-us/netframework/cc950529.aspx
http://www.codeproject.com/KB/aspnet/RestServicesInASPNET2.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Need a sample of a technique of Microsoft? Just check out CodeFx first! http://cfx.codeplex.com/
http://bbs.szblogs.com -
你好,
如果一定要用asmx而且不想用生成的proxy的话,就必需自己构造SOAP消息了. 你可以用Fiddler看以下收发的SOAP消息然后自己构造,用HTTPWebRequest发送.
另外还有一种方法.我们知道Silverlight可以调用JavaScritp方法,而JavaScript能够直接调用Web Service (当然也要自己构造SOAP消息). 但是ScriptManager提供了让JavaScript调用asmx的支持,这样我们就不必自己构造SOAP消息了.参考:http://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Need a sample of a technique of Microsoft? Just check out CodeFx first! http://cfx.codeplex.com/- 已标记为答案 Allen Chen - MSFTModerator 2009年8月6日 8:49