简体   繁体   English

WCF 休息和 Wcf 肥皂服务之间的区别

[英]Difference between WCF rest and Wcf soap Services

Am new to wcf concept.我是 wcf 概念的新手。

As Per my understanding, if the service endpoint binding is basicHttpBinding then it is soap service.根据我的理解,如果服务端点绑定是 basicHttpBinding 那么它就是肥皂服务。

And if the endpoint binding is webHttpBinding then it is Rest service.如果端点绑定是 webHttpBinding 那么它就是 Rest 服务。

In short if we can able to retrive result from browser by calling public methods, then it's a rest service..简而言之,如果我们能够通过调用公共方法从浏览器检索结果,那么它就是一个休息服务..

Please suggest is that correct.请建议是否正确。

Note: in case services are public accessible注意:如果服务是公共可访问的

In WCF you can use either the BasicHttpBinding (SOAP 1.1 specification) or the WSHttpBinding (SOAP 1.2 specification) for SOAP web services.在 WCF 中,您可以将 BasicHttpBinding(SOAP 1.1 规范)或 WSHttpBinding(SOAP 1.2 规范)用于 SOAP Web 服务。 Both of these bindings support SOAP messages.这两种绑定都支持 SOAP 消息。

The WebHttpBinding supports HTTP requests, and not SOAP messages. WebHttpBinding 支持 HTTP 请求,而不是 SOAP 消息。 However, a REST service is a lot more than just responding to HTTP requests, it is more about how you respond to the HTTP request, eg, using the HTTP verb (GET, POST, PATCH, DELETE) to map onto operations on a resource, so that GET = read, POST = create, PATCH = update, and DELETE = delete.然而,REST 服务不仅仅是响应 HTTP 请求,更多的是关于如何响应 HTTP 请求,例如,使用 HTTP 动词(GET、POST、PATCH、DELETE)映射到资源上的操作,因此 GET = 读取、POST = 创建、PATCH = 更新和 DELETE = 删除。 See this Wikipedia for the basics.有关基础知识,请参阅 Wikipedia。

So a WCF service may use the WebHttpBinding but not be a RESTful service.因此,WCF 服务可以使用 WebHttpBinding 但不是 RESTful 服务。 There is a lot more work involved to create a proper RESTful service.创建合适的 RESTful 服务需要做更多的工作。 In converse, a RESTful service does not need to use WCF and the WebHttpBinding.相反,RESTful 服务不需要使用 WCF 和 WebHttpBinding。 I recommend instead using ASP .Net Core and MVC to develop REST APIs.我建议改为使用 ASP .Net Core 和 MVC 来开发 REST API。 There is a good tutorial here .这是一个很好的教程在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM