World’s smallest Web Service’s demo using NetBeans

(Recently I had to give a small training on Web Services so using this straightforward article I came up with a bare-bones Web Service’s demo using NetBeans)


Install Java EE 5 Tools Bundle which includes NetBeans IDE 5.5, NetBeans Enterprise Pack 5.5, Sun Java System Application Server PE 9 and more.

Note: The Java SE Development Kit 1.5.0_09 (JDK) is required to install this bundle.

Build The Service

  • Create New Projects
  • Right click -> New Web App -> Java version 5
  • Right click -> New Web Service (eg. CalculatorWS)
  • Add method:

    public int add(@WebParam(name = “i”) int i,
    @WebParam(name = “j”) int j) {

    int k = i + j;

    return k;

  • Deploy

To test the service


The Java SE client (consumer)

  • Create New Project (no spaces in path!) -> e.g. “CalculatorWS_Client_Application”
  • Right-click New > Web Service Client.
  • Insert WSDL URL:
    http:// MY_SERVER:8080/PROJECT_NAME /CalculatorWSService?WSDL
  • Right click inside class -> Resources > Call Web Service Operation
  • Browse to the “add” operation and click OK
  • Give values e.g. port.add(3,4)
  • Rigth click client -> Run (it should print 7 – wiiihaaa!)


Social Bookmarks:


One thought on “World’s smallest Web Service’s demo using NetBeans

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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 )

Connecting to %s