Jump to: navigation, search

Creating a JAX-RS Web Service

1. Create a JAX-RS User library from the .jar files in this Apache WINK JAX-RS Implementation library:



2. Create a Dynamic Web Project targeting Tomcat and add the JAX-RS facet, specify org.apache.wink.server.internal.servlet.RestServlet as the JAX-RS  servlet class name on the JAX-RS Capabilities page:
Snap1.jpg Snap6.jpg

3. Import the Src.zip archive below into the src folder of the JAXRS project:



4. Add an Initialization parameter to the JAX-RS Servlet:


5. Define the Initialization parameter name and value as javax.ws.rs.Application and com.test.AddressBookApplication:


6. Start the server and add the JAXRS project to the server, enter the following URL in the browser to test the JAX-RS Web Service and obtain the addresses in the AddressBook:

http://localhost:8080/JAXRS/jaxrs/addresses Snap11.jpg