This post will primarily show you how to create a simple Web Service application through Apache Axis in Eclipse, and will not dwell on explaining the background or functionality of a Web Service.
Yet, it’s a de facto to at least give a little definition.
WSDL or the Web Services Definition Language is just another specification to describe network XML-based services.
It supports message-oriented and procedural approach XML technologies. (for further reading click here)
1. Preparing the web application
a. Create a new web application and name it as “SimpleWebService”.
b. Download and add “axis.jar” (download here) to the application libraries.
c. Edit and add this following configurations to the web.xml file.
< servlet >
< servlet-name >AxisServlet< / servlet-name >
< servlet-class >org.apache.axis.transport.http.AxisServlet
< / servlet-class >
< / servlet >
< servlet >
< servlet-name >AdminServlet< / servlet-name >
< servlet-class >org.apache.axis.transport.http.AdminServlet
< / servlet-class >
< load-on-startup >100< / load-on-startup >
< / servlet >
< servlet-mapping >
< servlet-name >AxisServlet< / servlet-name >
/servlet/AxisServlet< / url-pattern >
< / servlet-mapping >
< servlet-mapping >
< servlet-name >AxisServlet< / servlet-name >
< url-pattern >*.jws< / url-pattern >
< / servlet-mapping >
< servlet-mapping >
< servlet-name >AxisServlet< / servlet-name >
< url-pattern >/services/*< / url-pattern >
< / servlet-mapping >
*Note: spaces were created for display purposes only, adjust accordingly.
c. Create a public class and add any transactional method. In this sample i created “SimpleMessageTransport” method that accepts a string parameter and returns it to the server.
2. Creating Web Service
After successfully creating the artifacts of the Web application, it’s now time to create the Web Service.
a. From the file menu choose “New->Web Service”.
b. Configure exactly as shown in the picture below.
c. Then click Finish, it will then open a Web Service Client where you can verify and test.
Your project structure should look like this
Voila! you can now access your Web Service through the net!.
Comments
Post a Comment