·

Introduction

 

In
this tutorial we will create a simple web service and a client web application
using eclipse IDE along with
Lomboz
plug
in.
We
will also deploy and test the web service on Tomcat 5.5.4 web application
server. This application, while simple, provides a good introduction to Web
service development and some of the Web development tools available.

 

·
Environment

 

J2SDK
1.4.2

http://java.sun.com/

 

Eclipse
3.1

 

http://www.eclipse.org/

 

 

Tomcat
5.5.4

 

http://tomcat.apache.org/

 

 

Lomboz
3.1RC2

http://lomboz.objectweb.org/

 

 

 

·
Installation

 

Install
JDK (in D:\j2sdk1.4.2_04)

 

Install
Tomcat (in E:\Tomcat5.5)

 

Install
Eclipse (in E:\Eclipse3.1)

 

Install
Lomboz (in E:\Eclipse3.1)

 

·
Setting up

 

  1. Set
    up the installed JRE in eclipse (Windows -> Preferences -> Java ->
    Installed JREs)
     

 

 

  1. Set
    up the installed runtime for server in eclipse (Windows -> Preferences
    -> Server -> Installed Runtimes)
     

 

 

  1. Set
    up the Server view in eclipse (Windows -> Show View -> Other)
     

 


 

 

  1. Set
    up the Tomcat Server by right clicking and selecting New -> Server option
    from the Server view in eclipse
     

 

 

 

 

 

 

·
Creating a Web service

 

  1. Create
    a new Dynamic Web Project in eclipse (File -> New -> Other)
     

 

 

 

  1. Enter
    name as ?WebServiceTutorial?, select project location as ?E:\Test?
    and select Apache Tomcat v5.5 as the Target server.
     

 

 

 

  1. Now
    create a new Java class from the Project Explorer (Dynamic Web Projects
    -> Java Source -> New -> Class)
     

 

 

 

  1. Enter
    name as ?Hello? and package as ?com.tutorial?.
     

 

 

  1. Add
    a simple method in the ?Hello? class as below.
     


public String sayHello(String name){

 


return “Hello ” + name;

 


}

 


 

 

  1. Save
    and build the project.
     
  2. Create
    a new Web service in eclipse (File -> New -> Other)
     

 

 

  1. Select
    Generate a proxy.
     
  2. Select
    Test the Web service.
     
  3. Select
    Overwrite files without warning.
     

 

 

  1. Select
    or enter the Bean name as ?com.tutorial.Hello?. This is the java class
    that we just now created.
     

 

 

  1. Continue
    the wizard by clicking Next and finish.
     
  2. On
    Finish, the Tomcat server starts up and launches the Test client.
     
  3. Verify
    the generated contents. Look for Hello.class and the generated JSPs as
    below.
     

 

 

 

 

 

  1. Verify
    the Tomcat folder and ensure the newly created web applications ?
    WebServiceTutorial, WebServiceTutorialClient.
     

 

 

 

 

  1. We
    can also run the following url from the browser to access/test the Web
    service.
     

http://localhost:8080/WebServiceTutorialClient/sampleHelloProxy/TestClient.jsp

 

 

  1. If
    servlet error ?org.eclipse.jst.ws.util.JspUtils cannot be resolved or is
    not a type? is thrown on the browser, then copy the webserviceutils.jar
    file from the E:\Eclipse3.1\eclipse\plugins\org.eclipse.jst.ws.consumption_0.7.0
    into the WEB-INF\lib folder of the WebServiceTutorialClient application and
    restart the Tomcat server.
     
  1. The
    browser displays the methods available in the web service.
     

 

 

 

  1. Click
    on the sayHello(..) method, enter your name (for e.g. ?Jeeva?) in
    the inputs section and click ?Invoke?.
     

 

 

 

  1. The
    browser greets using the web service.
     

 

 

 

 

 

  1. The
    WSDL for the Hello Web service can be found in E:\Test\WebServiceTutorial\WebContent\wsdl\Hello.wsdl.
    On double-click, the WSDL opens in a graphical editor.
     

 

 

 

  1. Right-click
    on the WSDL file and explore the options to test the web service / publish
    the WSDL file / generate client / etc.
     

 

 

 

 

·
Conclusion

 

In this
tutorial we learned how to create a simple web service and a client web
application using eclipse IDE along with
Lomboz
plug
in.
We
also deployed and tested the web service on Tomcat 5.5.4 web application server.
This application, while simple, provides a good introduction to Web service
development and some of the Web development tools available.

Reference # http://www.roseindia.net/webservices/buildingsimplewebservice.shtml

 

Advertisements
Comments
  1. colleges with nursing programs says:

    What’s Going down i’m new to this, I stumbled upon this I’ve discovered It absolutely useful and it has helped me out loads. I am hoping to give a contribution & assist different customers like its aided me. Great job.

    Like

  2. Eva Angelina says:

    Merely a smiling visitor here to share the love (:, btw outstanding style and design. “Better by far you should forget and smile than that you should remember and be sad.” by Christina Georgina Rossetti.

    Like

  3. Capt. Bob says:

    You STOLE this from roseindia.net

    Typical Indian java developer…. jeesh

    Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s