Creating a simple SOAP web service using Eclipse
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
and click on Next
5. In the new dialog select "Top down Java bean..." for Web service type,
the next drop down label will change to "Service definition"
7. Move the "Test service" and "Test client" sliders to the top and click Next and Next
Click Next -> Next
A new page will be opened within eclipse with the available operations in the webservice
Note: When you run tomcat within eclipse, by default tomcat runs within the workspace i.e. all the apps are deployed within the workspace, logs are available within the workspace.
You can also export the webservice from Eclipse as a war file(project -> Export -> WAR) and deploy to a standalone tomcat manually.











Comments
Post a Comment