JaiswalTraining

Get the online training



Corejava Servlet Jsp  Php  Hibernate  Ajax Web Service   Ejb2.1 Ejb3.0 Struts Struts2  JPA Spring Ibatis   JSF    JSF2.0  CoreJavaDesignPattern    Jquery  Flex J2EE-Design-Patterns  Jboss7  Maven  Contact Me                                                                                                                                                                        
            IGNOU SMU PTU Project                                           Training                                                                                                                              
              

Contact Us  0091- 9210721663         jaiswaltraining@gmail.com




Corejava
Servlet
Jsp
Php
Hibernate
Ajax
Web Service
Ejb2.1
Ejb3.0
Struts  
Struts2
JPA
Spring
Ibatis
JSF
JSF2.0
CoreJavaDesignPattern
Jquery
Flex
J2EE-Design-Patterns
Jboss7
Maven








Axis2 Web Service Example

Axis2 Installation

  • Axis2 is not by default installed in the eclipse.
  • To make web service program on the apache axis2,
    axis2 must be installed and configured on the eclipse.
  • Download the apache axis2 tool from apach.org site.
  • Extract it to a folder.
  • Start the eclipse.
  • Select Window-->Preference..




  • Navigate to Web Services-->Axis2 Preferences.  
  • Browse the location to the axis2 extracted folder as shown below.





Web Service Program using Axis2 in Eclipse

  • Create a Dynamic Web Project.
  • Save it as webservice1.
  • Select tomcat server as Runtime.






  • Now create a ishaan.java 
  • Add the code below given.
  • Based on this we will create Web Service program.

public class ishaan {
  public String fact(int a) {
    int fact = 1;
    for (int i = 1; i <= a; i++) {
      fact = fact * i;
    }
    return "Factorial of " + a + "  is " + fact;
  }
}

Web Service Creation

  • Now we will create web service program.
  • As shown below select the  File-->New-->Web Services-->Web Service.


  • Click on next
  • In this window select  select the class file as ishaan




  • In the coming window  move the slider to up(start service level)



  • Click on the Web Service runtime
  • Select the Apache Axis2.



  • Now the Web Service runtime is Apache Axis2.
  • We will not create the client, so don't move the slider.
  • But for web service move the slider up to Test Service level

    .



  • Axis2 requires the services.xml.
  • Select the radio button Generate a default services.xml




  • Click on the next button.
  • It will ask for the Test Web Service.
  • Select the Web Services Explorer.



  • Click on the finish button.
  • It generates the given structure along with wsdl.



  • It will start the Web Service explorer in the browser.
  • Just select the ishaan web service node.
  • Expand it.




  • Click on the ishaanSoap11Binding.
  • It wil open the web service method fact for testing.



  • Click on the method fact.
  • Click on the Add.
  • Now add the value for web ervice method argument a.
  • Click on the Go button.
  • It will display the result in lower window.



Download above Eclipse Code