Generate a Java™ application programming interface
(API) for a RESTful Web Services (JAX-RS) service in a Java
Platform, Enterprise Edition (Java EE) 7 web project. This
JAX-RS service is based on a REST API definition file that is named
swagger.json.
About this task
Important: Applicable to Liberty, WebSphere® Application Server traditional
Procedure
-
Open the Generate JAX-RS Service wizard by completing one of the following
options:
-
If the Swagger Definition field is empty, enter the location of your
swagger.json file.
The swagger.json file exists in the workspace or the file system. Provide an
HTTP or file:// reference. If you right-clicked your
swagger.json file in the previous step, the location is already entered. You
can also drag your swagger.json file from an external file system to this
field.
-
Select the target Java EE 7 web project from the Project drop-down
menu.
Tip: Ensure that the JAX-RS 2.0 facet is enabled for the Java EE 7 target project.
-
In the Source Folder field, enter the target source folder that is defined
in the project.
-
In the Package field, enter the Java package of the generated service code.
-
Click Finish.
Results
You generated a JAX-RS service in the web project that you targeted. The Generate
JAX-RS Service wizard creates API and model packages. The JAX-RS resources reside in the
API package.