使用 C# 的远程 XML Web 服务
我的任务是创建远程 Web 服务。我问这个问题是为了找到实现我需要完成的任务的最佳方法,并看看是否有可能有帮助的代码示例。
任务
创建一个 Web 服务,在单击其他程序的按钮时接受参数。一个是用 C# 完成的 Windows 应用程序,该应用程序是旧的 Fortran as400 应用程序。我需要创建这个 Web 服务来接受来自其他系统的这些参数,然后在 Web 服务中我需要获取这些参数并将它们发送到存储过程,并使用结果创建一个 XML 文件并将其发布回客户端结尾。
这是否可能,如果可能,有人可以指出我可以在哪里看到一些示例或提供一些帮助。
I have been tasked with creating a Remote Web service. I am asking this question to get the best approach to what I need to accomplish and see if there is code examples out there that might help.
Task
Create a web service that accepts parameters when on button click of other programs. One is a windows app done in C# and the app is old fortran as400 app. I need to create this web service to acept these parameters coming from the other systems and then in the web services I need to take these parameters and send them to a Stored procedure and with the results create an XML file and post it back to the clients end.
Is this possible and if it is can someone point me to where I can see some examples or provide some help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如今,在 .NET 中创建 Web 服务的事实上的标准是 WCF。
The de-facto standard today of creating web services in .NET is WCF.
Web 服务不是一种固定且定义明确的技术,因此您有不同的选择。最常见的是 SOAP 和 REST。在我看来,SOAP 过于臃肿并且只在某些情况下才有意义。否则,REST 是首选。您可以在 http://en.wikipedia.org/wiki/Representational_State_Transfer。 REST 的一大好处是它只是 HTTP。因此,与使用 SOAP 相比,您更有可能拥有所需的可用库。
在.Net 中,您可以通过不同的方式实现 REST 服务。正如 Darin 提到的,WCF 是一种选择。但也可以使用 Asp.Net MVC。在我看来,MVC 更简单,但仍然灵活且强大。如果您是 WCF 专家(在问这个问题时不太可能),那就去吧。如果没有,我会选择 MVC。您可以在 http://www.asp.net/mvc 中了解有关 MVC 的更多信息。只需向 Google 询问“Asp.Net MVC Rest”,您就会得到一些如何将两者结合起来的提示。
Web service is not a fixed and well defined technology, so you have different options. The most common ones are SOAP and REST. In my opinion SOAP is to bloated and makes only sense in certain situations. Otherwise REST is the first choice. You can get a first overview of REST at http://en.wikipedia.org/wiki/Representational_State_Transfer. One big benefit of REST is that it's just HTTP. So compared to using SOAP it's much more likely that you have the required libraries available.
In .Net you can implement REST services in different ways. As Darin mentioned, WCF is one choice. But it's also possible using Asp.Net MVC. MVC is much simpler but still flexible and powerful in my opinion. If you are an WCF expert (unlikely when asking this question), go for it. If not, I'll go for MVC. You can learn more about MVC at http://www.asp.net/mvc. Just ask Google for "Asp.Net MVC Rest" and you'll get some hints how to combine both.