Java JAX-RS Web 服务问题
- 用@Path注释的类和用@WebService注释的类有什么区别(什么是服务端点实现)?
阅读文档后,@WebService 与 SOAP 一起使用,其中 @Path 用于 REST。
- java 中任何带有 Web 客户端的 REST 最简单示例都会消耗同一应用程序中服务的资源吗?客户端和Web服务之间的通信方式是什么?
谢谢。
- What is the difference between a class annotated with @Path and a class annotated with @WebService (What is Service endpoint implementation) ?
After reading the documentation, @WebService is used with SOAP where @Path is for REST.
- Any REST simplest example in java with a web client consumes resource from a service in a same application ? What is the communication method between client and the web service ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@Path
用于 JAX-RS 服务(即 REST 接口),而@WebService
用于 JAX-WS 服务(即SOAP 接口)。原则上,完全有可能将两者放在同一个类上——两者之间正式没有交互——尽管我发现在实践中两个服务接口之间几乎没有任何共享更简单; REST 和 SOAP 在细节上似乎有着截然不同的期望。在 REST 中,客户端通过 HTTP 与服务器通信。 REST 的很大一部分在很多方面都很好地使用了 HTTP。不过,我永远不想尝试使用 REST 在同一进程中的客户端和服务器之间进行通信;所有通过网络服务器部件只是为了从一个对象转到另一个对象?当您可以进行直接方法调用时,工作量很大......
@Path
is for JAX-RS services (i.e., a REST interface) whereas@WebService
is for JAX-WS services (i.e., a SOAP interface). In principle, it's entirely possible to have both on the same class – there's formally no interaction between the two – though I find it simpler in practice to have next to nothing shared between two service interfaces; REST and SOAP seem to have quite different expectations in detail.In REST, clients communicate with servers via HTTP. A significant fraction of REST is in many ways just using HTTP well. I wouldn't ever want to try to use REST to communicate between a client and a server in the same process though; all that going through the web-server parts just to go from one object to another? Way to much work when you can do a direct method call…