To create a web service, you need to complete the following steps:
- Right-click the TestApp project in the Projects tab.
- Select Web Service from the New option.
- Specify a name for your web service in the Web Service text box. For example, HelloServer.
- Enter com.example in the Package field.
- Select Create an Empty Web Service and click the Finish button.
- In the Projects dialog box, expand the Web Services node.
- Right-click the HelloServer web service.
- Select Add Operation. This opens the Add Operation dialog box.
- Specify a name for the method in the Name text box. For example, type display.
- Specify the return type of the method in the Return Type drop-down list.
- In the Input Parameters and Exception section, click the Add button under the Parameters tab to define a parameter for the method defined earlier.
- Click OK to proceed.
- Next click OK in the Add Operation dialog box. This creates the operation skeleton.
- 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.
|