在 ASP.NET 上将 asmx SOAP webservice 转换为 REST:WCF 真的有用吗? [英] Converting asmx SOAP webservice to REST on ASP.NET: is WCF really useful for just that ?

查看:21
本文介绍了在 ASP.NET 上将 asmx SOAP webservice 转换为 REST:WCF 真的有用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么不只在配置中添加 http get 支持,这样做的好处是该服务将同时具有 SOAP 和 REST 双重功能?

Why not just add http get support in config and that's done with the advantage that the service will be dual both SOAP AND REST?

关于休息的所有嗡嗡声是什么?WCF 将为此带来什么?

What's all the buzz around rest ? What WCF will bring to this ?

我的意思是从 REST 客户端应用程序的角度来看有什么区别,如果我只是在我的 web.config 中为我的 asmx 网络服务设置了能够接受类似 get 的语法

I mean what's the difference from the viewpoint of a REST client application if I just set in my web.config for my asmx webservice to being able to accept get rest-like syntax

  <webServices>
    <protocols>
      <add name="HttpGet" />
    </protocols>
  </webServices>

和 WCF REST 实现 http://geekswithblogs.net/.NETonMyMind/archive/2008/02/04/119291.aspx ?

and a WCF REST implementation http://geekswithblogs.net/.NETonMyMind/archive/2008/02/04/119291.aspx ?

似乎没有人能真正回答......是因为它很难还是我的问题很愚蠢:)

seems nobody can really answer ... is it because it's hard or is it my question is stupid :)

Client 只看到 url(封装原理),我为什么要费心呢?还有什么还不清楚:)

Client only sees url (encapsulation principle) so why would I bother for more ? And what's the more that's still not clear :)

其他问题:如果我们切换到 WCF,我们是否需要更改 url ?如果是,那意味着我们所有的一百个合作伙伴客户都将被破坏,我必须将我们的更改通知他们?

Other problem: if we switch to WCF, will we need to change url ? If yes that means all our hundred partners clients would be broken and I'll have to notify them of our change ?

推荐答案

WCF 与 REST 无关.您可以在不使用 WCF & 的情况下构建自己的 REST 服务.SOAP 东西.. 在 .Net 2.0

WCF is nothing to do with the REST. You can build your own REST services without using WCF & SOAP stuff.. Check out this sample REST service build in .Net 2.0

并查看出色的 .Net 开源 REST 实现

要了解有关 REST 的更多信息,请阅读这些内容

To understand more about REST, read these

  1. http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
  2. http://en.wikipedia.org/wiki/Representational_State_Transfer
  3. RESTful 编程究竟是什么?
  4. WCF 服务的 REST/SOAP 端点
  5. 了解 REST:动词、错误代码和身份验证

致您的评论:

如果我已经有一个 asmx 网络服务可以转换为 REST一行配置文件?

if I have already an asmx webservice that can be converted to REST just in one line of configuration file ?

ASMX 服务建立在 SOAP 之上,在 HTTP 之上又多了一层.REST 只是基于 HTTP 的,您可以像访问普通 URL 一样访问(或调用)您的业务资源.没有更多的抽象.

ASMX services are build upon SOAP, one more layer over HTTP. REST is simply a HTTP based, You can access(or call) your business resources the way you access the normal URLs. No more abstractions.

在 REST 中,资源由持久标识符(URL)标识.

In REST, resources are identified by persistent identifiers(URLs).

对于产品目录系统中的 ex,通过使用 asmx,您可以创建一组功能来添加、更新、删除产品.如 addProduct()、updateProduct 等.

For ex in products catalog system, by using asmx you create set of functions to add,update,delete products. like addProduct(),updateProduct, etc..

但在 REST 中,您将拥有单点访问,例如http:\我的系统\产品.要检索、添加、更新、删除产品,您将在同一 URL 上使用相应的 HTTP 动词(GET、POST、PUT、DELETE).

But in REST, you will be having single point of access, like http:\mysystem\prodcuts. To retrieve,add,update,delete products, you will be using respective HTTP verbs (GET,POST,PUT,DELETE) on the same URL.

所以你不能只是将 asmx 转换为 REST,因为两者都以不同的方式解决问题.

So you cannot just convert asmx to REST, since both solves the problems in different way.

这篇关于在 ASP.NET 上将 asmx SOAP webservice 转换为 REST:WCF 真的有用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆