Jax-RS 是与 Web 服务通信的正确解决方案吗?
我很快将开始一个用 Java 编写的项目,并将与基于 PHP 的 Web 服务进行通信。我最初认为,根据我所读到的内容,Jax-RS 将是正确的解决方案,因为我认为我的 Java 端需要成为一个 Web 服务。从那时起我就知道它不会,但它会与 Java 进行大量通信。如果我发送请求并接收响应,Jax-RS 是一个好的解决方案吗?还有其他工具还是标准的java?
I'm going to be beginning a project soon that will be written in Java and will communicate with a PHP based web service. I initially thought with what I was reading that Jax-RS would be the right solution because I thought that my Java side would need to be a Web Service. Since then I've learned it won't, but it'll have a lot of communicating to do with Java. Is Jax-RS a good solution if I'm sending requests and receiving responses? Is there another tool or just standard java?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您想使用(RESTful)网络服务,那么您可以使用所谓的客户端API。大多数 JAX-RS 实现,例如 Jersey 或 RESTEasy 包括一个,例如:
通过 Jersey Client API 使用 RESTful Web 服务
请注意,这还不是 JAX-RS 标准的一部分,但很快就会成为:
If you want to consume (RESTful) web services, then you could use a so-called client-API. Most JAX-RS implementations like Jersey or RESTEasy include one, e.g:
Consuming RESTful Web Services With the Jersey Client API
Do note that this isn't yet part of the JAX-RS standard, but it soon will be:
标准 Java:HttpUrlConnection
第 3 方:Apache < a href="http://hc.apache.org/httpcomponents-client-ga/" rel="nofollow">HttpClient
Standard Java: HttpUrlConnection
3rd Party: Apache HttpClient
尝试 RestTester 来自 rexsl-test 客户端。它是一个具有内置断言功能的 RESTful 客户端。您可以使用简单的流畅的界面发出请求并在响应上运行断言。
Try RestTester from rexsl-test client. It is a RESTful client with built-in assertion functionality. You make requests and run assertions on response using a simple fluent interface.