RESTful 服务合约
像 WSDL 一样,它向客户端公开的 RESTful 服务的契约是什么。是否有任何 java 框架可以自动创建客户端以使用 RESTful 服务?
like WSDL what is the contract for RESTful service it exposes to client. Are there any java frameworks to create the client automatically for consuming RESTful Services ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 REST 中,您的媒体类型和链接关系就是您的合同。您可以使用 WADL 作为运行时发现机制,但它远不如使用超媒体灵活为基础的表示。
REST 系统永远不应该使用 WADL 之类的东西来生成客户端代理类。
In REST your media types and your link relations are your contracts. It is possible you use WADL as a runtime discovery mechanism, but it is far less flexible than using hypermedia based representations.
REST systems should never use something like WADL to generate client proxy classes.
Jersey 可能是服务器上最流行的 Java REST 库。他们还有客户端库,允许您通过 示例
Jersey is probably the most popular REST library for Java on the server. They also have client libraries that allow you to consume RESTful services with an example
WSDL 的 RESTful 等价物是 WADL
The RESTful equilivant of a WSDL is a WADL
REST 服务使用所谓的“统一契约”或“统一接口”,它基于 http 动词。因此,REST 服务的契约是统一接口及其支持的 URI 的组合。
为了调用 SOAP 服务,我们选择一个操作以及该服务的 WSDL 定义的具体部分中指定的地址。
为了调用 REST 服务,我们选择一个 http 动词和一个 URI。
REST services use what's called "uniform contract" or "uniform interface", which is based on http verbs. Thus, the contract of a REST service is a combination of the uniform interface and the URIs it support.
To call a SOAP service we pick an operation and the address specified in the concrete section of that services's WSDL definition.
To call a REST service we pick an http verb and a URI.