什么是“预期”? WCF Web 服务消费者?
我接到的任务是在从返回 SOAP XML 的 WCF Web 服务加载页面时在 ASP .net 页面上显示数据。我已经对 Web 服务进行了编码,它成功返回了一个列表。现在的讨论归结为我如何使用该服务。当然 - 我觉得我想在 PageLoad 上执行此服务器端操作并以这种方式填充表格。但我的印象是,带有 SOAP XML 响应的 WCF Web 服务的整个概念是提供客户端脚本来调用方法来接收这些列表? C# 服务器端调用/使用 WCF Web 服务是否常见?
I have been given a task to display data on an ASP .net page on page load from a WCF web service that returns SOAP XML. I've coded the web service, and it succesfully returns a List. The discussion now is down to how I consume the service. Naturally - I feel like I want to do this server-side on PageLoad and populate a table that way. But I get the impression that the whole concept of WCF web services with a SOAP XML response is to provide client-side script to invoke methods to receive these lists? Is it common for WCF web services to be invoke/consumed by C# server-side?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,服务器消耗其他服务是很常见的。服务只是您获取一些信息的地方,无论谁在使用它。在您描述的情况下,您的“服务器”是服务的“客户端”。
Yes, it is very common for servers to consume other services. A service is just a place for you to get some information, regardless of whom is consuming it. In the case you are describing, your 'server' IS the 'client' of the service.
如果服务生成 SOAP,请在服务器端使用它。
如果是JSON(RSS、POX)服务则可以直接使用JavaScript。
当然,所需的处理/存储也在这个决定中发挥着作用。
If the Service produces SOAP, consume it on your Serverside.
If it is a JSON (RSS, POX) service you can directly use JavaScript.
But of course the required processing / storage also plays a roll in this decision.
它还取决于您希望页面如何运行。我的上一份工作是开发 ASP.NET 应用程序,而我们的客户讨厌所有的回发。如果您在服务器端使用 WCF 服务并且页面需要频繁更新,则每次更新都需要回发。这没有什么错,只是一个权衡。如果您希望更新带来更流畅的用户体验,那么您可以通过 AJAX 使用 WCF 服务客户端。这完全取决于您想要的用户体验。
It also depends upon how you want your page to function. My last job was working on an ASP.NET app and our customers HATED all of the postbacks. If you consume the WCF service server-side and the page requires frequent updates then each update will require a postback. There's nothing wrong with that, it's just a trade off. If you want updates to yield a smoother user experience then you can consume the WCF service client-side via AJAX. It all depends on what you want your user experience to be like.