Hello Web Service end to end scenario

Author: Lukas Jungmann
Last update: $Date: 2009/10/29 16:50:43 $, $Revision: $

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:

    Project Features

    About this Project

    QA was started in November 2009, is owned by Jiří Kovalský, and has 104 members.
    By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
    Please Confirm