本文介绍了如何使用html5消费wcf服务而不需要修改它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我们有一个MVVM架构的项目,我们依靠wcf服务来返回数据。客户端是银光。现在我们想要保留模型而不修改它,但客户端将纯粹是HTML5并需要ajax来调用service.Is它可能吗?特别是当你知道使用silverlight时我们使用datacontract而在html5中我们需要json,就像我想的那样。换句话说,我们希望与wcf服务具有相同的模型,客户端将是silverlight,html5 ...... 并且是否有必要添加属性WebInvoke [OperationContract] [WebInvoke(方法= POST,BodyStyle = WebMessageBodyStyle.Wrapped,RequestFormat = WebMessageFormat.Json,ResponseFormat = WebMessageFormat.Json)] VMActeur Authenticate(UserProfile userProfile); 解决方案 Hi,We have a project with MVVM architecture and we rely on to wcf service to return data.The client side was a silverlight .Now we want to preserve the Model and not modifying it but the client side will be purely HTML5 and need ajax to call service.Is it possible?especially as y know that with silverlight we works with datacontract and in html5 we need json as i thought. In other word , we want to have the same model with wcf service and the client will be whatever silverlight ,html5...And Is it necessary to add the attribute WebInvoke[OperationContract][WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]VMActeur Authenticate(UserProfile userProfile); 解决方案 这篇关于如何使用html5消费wcf服务而不需要修改它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-19 08:44