Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java JAX-RS REST service client code generation [closed]

I am looking for tools to generate documentation and client code (in various languages such as Java, Scala, Ruby, JavaScript, etc.) using annotation on my JAX-RS REST service. Ideally, I'd like to run a post-build tool that, given the package where my REST service classes live, will generate both documentation and code using (custom) annotation on the source code and some minimal configuration. Kind of what Swagger does but without having to deploy its servlet and all that stuff. I tried bending swagger-codegen to do this with no luck. The documentation is small and fragmented and the examples are few. I can't imagine this isn't a solved problem. Ideas?

like image 278
Giovanni Botta Avatar asked Feb 14 '23 02:02

Giovanni Botta


2 Answers

If you're using Jersey then it will automatically generate WADL from your JAX-RS services. You can then use wadl2java to create client stubs.

like image 108
francesco Avatar answered Feb 17 '23 06:02

francesco


You can use CXF to generate client code from your annotated server side code. See http://blog.rjsang.com/2014/01/using-cxf-as-jax-rs-server-and-client.html.

In the example CXF is both the server and client but it doesn't have to be as long as you are using JAX-RS standard annotations.

like image 22
rjsang Avatar answered Feb 17 '23 08:02

rjsang