简体   繁体   English

在 Eclipse 中生成 RESTful Web 服务客户端

[英]Generate RESTful Web Service Client in Eclipse

I have developed a restful java web service using jersey in eclipse.我在 eclipse 中使用 jersey 开发了一个宁静的 java web 服务。 Now I need to generate the client side for this web service.现在我需要为这个 Web 服务生成客户端。 I know this is possible in Netbeans, but how can it be done in eclipse?我知道这在 Netbeans 中是可能的,但是如何在 eclipse 中完成呢?

So far I have tried creating a new web service client in New->Other->Web Services but it asks for a service definition in the form of a WSDL, WSIL or HTML document.到目前为止,我已经尝试在New->Other->Web Services 中创建一个新的Web 服务客户端,但它要求以 WSDL、WSIL 或 HTML 文档的形式提供服务定义。 How can I generate these?我怎样才能生成这些? As far as I know, there is no WSDL for REST because services are openly described.据我所知,REST 没有 WSDL,因为服务是公开描述的。

Also If it is possible to generate a client, can it be done inside the REST web service project itself?另外,如果可以生成客户端,是否可以在 REST Web 服务项目本身内部完成?

To generate a client project you can use Eclipse wizard "New Maven Project": See example http://www.vogella.com/tutorials/EclipseMaven/article.html要生成客户端项目,您可以使用 Eclipse 向导“新建 Maven 项目”:参见示例http://www.vogella.com/tutorials/EclipseMaven/article.html

To create a call to REST service from client you can use Jersey Client API: See example https://jersey.java.net/documentation/latest/client.html要从客户端创建对 REST 服务的调用,您可以使用 Jersey 客户端 API:参见示例https://jersey.java.net/documentation/latest/client.html

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

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