Posts

Showing posts from October, 2021

Simple REST web service using Eclipse

Image
  As part of my work I had to create a REST client using Java and I ended up creating a REST web server to test my client Before you start, you should have a minimum understanding of Web service, HTTP, Eclipse and Java (JAX-RS) Things you need to have installed JDK, Eclipse and Tomcat (or TomEE).   I Used Eclipse   Version: 2020-06 (4.16.0) and Tomcat version 9 and JDK 8 Below are the steps 1.     Create an eclipse Maven project ( File->New->Maven Project or File->New->Other->Maven Project) Click Next 2. In the next screen, l eave the defaults as is and click Next 3. Type "jersey" into the Filter textbox , wait for it to populate the scrollbox beow, scroll down and select "jersey-quickstart-webapps"   Note: Unselect "Show the latest version..." checkbox and select a suitable version (leaving it checked will only show the latest version which failed for me when maven was downloading the dependencies) 4.  Fill in project Group Id...

Creating a simple SOAP web service using Eclipse

Image
  Creating a simple SOAP webservice from WSDL i.e contract first approach Recently I was asked to create a SOAP client using WSDL but when it was time to test the client the web service was not yet ready. I ended up creating a mock web service to test my client. I used eclipse to create the web service and tomcat to deploy it.  BTW I assume you are familiar with WSDL, using Eclipse and Tomcat, if not google it. Also having a minimum understanding of SOAP Web service, HTTP, and Java (JAX-WS) would be needed. Also note, this is not a indepth technical info on web service or how it works, its more for lazy people like me who have to create one and who have been forced to work in IT because of socio economic reasons Anyway here is goes, 1. Create a new dynamic web project in eclipse (File -> New -> Dynamic Web Project) 2. Give the project a suitable name, select the target runtime and  click on finish   3. Copy the WSDL file to the new project 4. Add a new web serv...