Tuesday, March 17, 2015

A simple Rest Web Service using basic JAX-RS notations in Maven

I am just trying to jot down some very basic steps to stand up a simple Rest WebService.
WebService in Today's world play a very vital role in Web Aplication'zs world.

To understand theory behind Rest , please refer my other blog.


1.)  Create a new Maven Project

               Archetype : maven-archetype-webapp

2.) pom.xml content : Add dependencies for Spring core,web & web-mvc and Apache CXF



3.)  web.xml --

  • It needs to have a Servlet for Apache CXF , we can also use Jersey libraries instead
  • context param us defined to laod beans.xml which contains endpoint for our webservice


3.)  Let's jump to beans.xml where in we define our endpoint reference bean for the "Jaxrs" , you may also jump to step 4 and then implement this step.


4.) Lets Create the UserEndPoint which would have the actual business logic -



And we are ready just build it and deploy it in your web-server(Tomcat)

Execute the url in browser

http://localhost:8080/services/user/id





for any questions write me at jsapan4@gmail.com


     

1 comment: