cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

Hello Web Service end to end scenario

Author: Lukas Jungmann
Last update: $Date: 2006/07/14 13:44:39 $, $Revision: 1.3 $
Introduction:

This end to end scenario should test creation of simple web service from scratch with simple logging message handler in web project. The scenario covers developing of simple JAX-WS 2.0 based web service with message handler.
The document is not intended as test specification for this feature but describes developing simple web service in NetBeans 5.5.

Table of Contents


Web application sources are avalaible here.

Creating web project

  • Go to File - New Project - Web - Web Application
  • Specify HelloWs as Project Name
  • Specify project's directory
  • Choose Java EE 5 as J2EE version and
  • Click Finish

Creating web service

  • Go to File - New File - Web services - Web Service - Next
  • Specify name of web service, eg. HelloWebService
  • Specify package for the web service, eg. org.netbeans.end2end.hellosample
  • Click Finish

Implementing web service

  • Uncomment commented code in source file
  • Add serviceName="GreeterWs" to WebService annotation
  • Add operationName="sayHi" to WebMethod annotation
  • Add @WebParam(name="name") to String param argument of method operation
  • Add new sayHello(String): String operation to web service using Web Service -> Add Operation... action in editor
  • Implement both operation, so the implementation class will look like this:

Creating message handler

  • Go to File - New File - Web services - Message Handler - Next
  • Specify name of message handler, eg. MessageHandler
  • Specify package for the message handler, eg. org.netbeans.end2end.hellosample
  • Click Finish
  • Implement simple log method in handler, eg. like on following picture:
  • And add handler to the webservice using Configure Handlers... action in context menu on HelloWebService's node

Testing web service

Now we finished our web application with web service and we're ready to build and deploy it and check web service if it works correctly.

  • Invoke Deploy action from project's context menu
  • Invoke Test Web Service action from web service's context menu

Let's test web service using the form opened in web browser:

Companion
Projects:
MySQL Database Server   GlassFish Community: an Open Source Application Server   Open Solaris  Open JDK: an Open SourceJDK   Mobile & Embedded Community     Sponsored by 
Sponsored by Sun Microsystems