Exercise 1.3: Create the Web service

Before you begin, you must complete Exercise 1.2: Import and validate the WSDL file.

Starting the server

Before you attempt to create a Web service it is strongly suggested that you start the WebSphere Application Server on which the Web service will run. Although you can start the server in the Web service wizards, since it may take several minutes to start depending on the speed of your machine, starting the server before you begin will both increase the speed with which you complete the wizard and reduce the chance that the wizard will generate an error because the server is taking too long to start.

To start the server, right-click the server in the Servers view and select Start:

If the Servers view is not open in your workspace, open it from the Window menu by selecting Show View > Servers.

Create a Web service from a WSDL file

The Web Service wizard assists you in creating a new Web service, configuring it for deployment, and deploying the Web service to a server. Once your Web service is deployed, the wizard assists you in generating the client proxy and sample application to test the Web service. When you have completed testing, you can publish your Web service to a UDDI Business Registry using the Export wizard.

  1. In the Project Explorer view, select the ConvertTemperature.wsdl document in your Web project.
  2. Click File > New > Other. Select Web Services in order to display the various Web service wizards. Select the Web Service wizard. Click Next.
  3. In the Web Services panel, select Skeleton EJB Web Service as your Web service type. Also select the following: The following selections should be selected for this example:
    Screen capture of Web Services wizard
  4. On the Object Selection page, the WSDL file should be pre-filled. If not, browse to the WSDL file that you imported.
  5. In the Service Deployment Configuration page, you can specify the deployment settings. The IBM WebSphere run-time environment is set as the default run-time environment in both server-side and client-side configurations.
    1. In the Server-Side Deployment Selection section, type TempEJB in the Server Project field and TempEJBEAR in the server EAR field.
    2. In the Client-Side Environment Selection section, leave the client type as Web project, enter WebProjectClient for the Client Project field, and enter WebProjectClientEAR as the Client project EAR. Generating the service and client projects into different EARs will reduce the likelihood of encountering errors at run time.
    3. Click Next.

    Screen capture of the Service Deployment Configuration page with the fields completed as described in the step.
  6. On the Web services skeleton EJB configuration page, type WebProject as your router project.
  7. In the Web Service Test page, you can select a test facility to test your Web service before a client or proxy is developed. Select Web Services Explorer as the test facility for your Web service and click Launch. This step may take several seconds for the WebSphere Application server to start.
  8. The Web Services Explorer is displayed in a Web browser. Select fahrenheitToCelsius or celsiusToFahrenheit from the operations list. Enter a number in the value field and click Go. A trivial implementation of each of these operations is provided, and a default value of -3 is returned. If both operations complete successfully, close the browser window and click Next in the Web services wizard.
  9. In the Web Service Proxy page, ensure Generate proxy is checked. Keep the Security Configuration selection at No Security to remain WS-I compliant. Click Next.
  10. In the Web Service Client Test page, ensure Test the generated proxy and Run test on server are both selected. In the Methods section. ensure that all methods are selected, or click Select All to select all methods. If you want to publish your Web service to a UDDI Registry, click Next to configure the Web Service Publication options. However this step will not be covered in this tutorial. Otherwise, click Finish.
  11. The sample application is launched in a Web browser. You can use this application to test the Web service by selecting a method in the Methods frame, entering an input value in the Inputs frame, and clicking Invoke to view the result in the Result frame. Do not close the TestClient.jsp browser window yet - it will be used to test the Web service traffic for WS-I compliance later in this tutorial.

Now you are ready to begin Exercise 1.4: Implement the temperature conversion methods.

Feedback
(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.