SOAP Web 服务和 RESTFUL Web 服务之间的区别
我是Java新手。我知道有两种类型的Web服务
- SOAP Webservice。
- RESTful Web 服务。
任何人都可以告诉我它们两者之间的基本区别是什么。以及在哪种情况下创建 SOAP Webservice
以及在哪种情况下创建 RESTful Webservice
。
谢谢你,
I am new to Java.I know that there are two types of web service
- SOAP Webservice.
- RESTful Webservice.
can any one please tell me what is the basic difference between both of them.And in which situation the SOAP Webservice
is created and in which situation RESTful Webservice
is created.
Thank You,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在非常基础的层面上,SOAP 是一种消息传递协议,REST 是一种设计理念,而不是一种协议。当您基于 SOAP 协议构建 WebService 时,您基本上遵守以下 SOAP 规则:创建服务请求、将请求发布到服务器、在服务器接收请求、处理请求并以 SOAP 消息的形式返回结果。SOAP 不说话。关于客户端从服务中受益的确切方式,也不关于如何设计客户端本身(除了它发布的消息),它只告诉如何将来自客户端的消息发送到服务并返回。
REST 是表述性状态转移的缩写。它没有指定创建消息并将其发布到服务器的规则。您可以通过简单的 HTTP 协议来完成此操作。 REST 指定的是客户端和服务器管理其状态的方式,以便它们对客户端 - 服务器通信有用。在这里,您更专注于设计客户端和服务器的状态,而不是它们交换的消息。
At a very basic level , SOAP is a messaging protocol , REST is a design philosophy , not a protocol. When you base a WebService on a SOAP protocol , you basically comply with SOAP rules of creating a Service Request , posting the request to server , receiving the request at server , processing the request and returning the results as a SOAP message.SOAP does not talk about the exact manner in which client benefits from the service, nor about how to design the client itself ( apart from the message it is posting ), it only tells how a message from client can be sent to service and back.
REST is short for REpresentational State Transfer. It does not specify the rules to create a message and post it to server. You can do this by simple HTTP protocol. What REST specifies is the manner in which client and server manage their states so that they become useful to the client -server communication. Here , you are more focussed on designing the states of clients and servers rather than the messages they are exchanging.
正如第一个答案已经解释的那样,SOAP Web 服务和 REST Web 服务在很多方面有所不同。
SOAP:
SOAP WS 的一个很好但不太容易上手的框架是 Apache CXF
REST(到目前为止还没有实践经验,请随意纠正和改进;) ):
我确信,我还遗漏了其他几点。但我认为这是一个有用的开始。
As the first answer allready explains, SOAP Webservices and REST Webservices differ in various points.
SOAP:
A good but not so easy to start with framework for SOAP WS is Apache CXF
REST (no hands on experience up to now, feel free to correct and improve ;) ):
I am sure, there are several other points I missed. But I think it's a usefull start.