Creating the Web Service

To create a web service, you need to complete the following steps:

  1. Right-click the TestApp project in the Projects tab.
  2. Select Web Service from the New option.
  3. Specify a name for your web service in the Web Service text box. For example, HelloServer.
  4. Enter com.example in the Package field.
  5. Select Create an Empty Web Service and click the Finish button.
  6. In the Projects dialog box, expand the Web Services node.
  7. Right-click the HelloServer web service.
  8. Select Add Operation. This opens the Add Operation dialog box.
  9. Specify a name for the method in the Name text box. For example, type display.
  10. Specify the return type of the method in the Return Type drop-down list.
  11. In the Input Parameters and Exception section, click the Add button under the Parameters tab to define a parameter for the method defined earlier.
  12. Click OK to proceed.
  13. Next click OK in the Add Operation dialog box. This creates the operation skeleton.
  14. In the HelloServer.java file, which is an implementation file, fill out the operation skeleton. Replace return null; with return “Hello ” + name + “!”; in the body of the HelloServer operation as displayed.

 

  » View Media Description for Demo
Click the Next button to continue.