简体   繁体   中英

Consume Jersey WebService I/O

i need to create a project which read/consume a jersey impl service and get i/o methods specs, like this example:

on the request with jersey api through this uri

https://portal.com/security/rest/users?fullname=name%20surname

uri response:

[{"username":"username","fullname":"name surname"}]

i have to know which in the other side is like that:

  @GET
  @Path("/users")
  @Produces({ MediaType.APPLICATION_JSON })
  public User getUsers(@QueryParam("fullname") fullname) {
    return null;
  }

And have to write a XML or JSON approximately:

<method name="getUsers">
    <request type="param">
     <parameters type="QueryParam" name="fullname"/>
    </request>
    <response type="MediaType.APPLICATION_JSON" object="User">
    <array type="Object">
      <object>
        <username>username</username>
        <fullname>name surname</fullname>
      </object>
    </array>
    </response>
</method>

PS: the response of my api may be in json also

What method u have for me? Read WADL ? Swagger or other api can do that for me? (Describe a rest webservice in runtime getting a description of all methods)

It is unclear from your question whether you have control on the server-side as well or not.

If you do, you can integrate swagger-core in it to expose a Swagger specification from your application at runtime. You can then use swagger-codegen to create a client using several frameworks and languages from that spec. The resulting clients have zero dependency (or awareness) of Swagger.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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