Friday, April 13, 2012

Creating Bottom Up WebServices

Web services can be created using two methods: top-down development and bottom-up development. Bottom-up Web services development involves creating a Web service from a Java bean or enterprise bean.
When creating a Web service using a bottom-up approach, first you create a Java class and then use the Web services wizard to create the WSDL file and Web service.

Prerequisites: Install Apache Tomcat6.0.2,Eclipse IDE,Apache Axis-2 1.4.1
Create a new Dynamic Web Project in Eclipse
New-->DynamicWebProject Give the project name as TestServices.
Select the Target runtime Apache Tomcat In the configuration click on modify then select Axis2 webservices as shown below.
Note: To install Axis2 in Eclipse go to windows-->Preferences-->WebServices--> Axis2 Preferences Under the tab Axis2 runtime browse for axis2 runtime location and click ok.


Step: 2  Under src create a java class as shown below

Step:3  Under WebContent-->WEB-INF-->services     
create two folder called  HelloService-->META-INF and paste the service.xml file here as shown below.In the service.xml file you need to specify the Servicename and service class.

Step:4 When you run the project the Deployment descriptor will invoke the services.xml file automatically. Since we are specifying our java class in the services.xml file it will invoke service.xml file and generate the WSDL file on the fly.
Select the project (TestServices)  and right click on it Run As-->Run on server

Step :5 When you click on Services in the browser you can see the list of services and methods defined for the service .In our case we have only one service called HelloService as show below..

Step : 6 When you click on the HelloService you can see the WSDL file. Axis engine will generate wsdl file on the fly for us.

This is how you create a topdown webservices. Now lets go through consuming the webservices.


  1. The blog is good and very informative.

  2. Step by step instructions, very easy to follow and very self explanatory.

    Can you please upload the war file this application

  3. good tutorial ... Every thing is explained clearly with screenshots that helps for beginners alot. Could you upload the topdown approach for creating webservices as well

  4. guud Job,step wise explanation makes easier for beginners to have a quick review... can you please let me know how come the client who is trying to access Web Service can know,type of methods and services provided by a particular Web Service which we created.

  5. The Services.xml file will redirect to the Main service.

  6. hey i have eclipse indigo and it does not have the option to create a dynamic web project, could u tell me which version and flavor of eclipse u have used here?

  7. I am using Eclipse Galileo Java EE IDE for Web Developers version 3.5