< Previous | Next >

Lesson 1.4: Implement the temperature conversion methods

Before you begin

Before you begin, you must complete Lesson 1.3: Create the web service.

About this task

Trivial implementations of the fahrenheitToCelsius and celsiusToFahrenheit methods were automatically generated when you created a web service from your WSDL document. In this section you will replace these trivial implementations with more meaningful code, and perform the necessary steps to test your new methods.

Procedure

  1. In the Enterprise Explorer view, select ConvertTemperatureSoapBindingImpl.java under TempEJB > Session Beans.
  2. Locate the fahrenheitToCelsius method and replace the current implementation with the following: return (fahrenheitValue - 32) / 9 * 5;
  3. Locate the celsiusToFahrenheit method and replace the current implementation with the following: return (celsiusValue * 9 / 5) + 32;
    Temperature conversion
  4. Save your updates by clicking File > Save.
  5. Restart the EAR by expanding your server in the Servers view and right-clicking TempEJBEAR > Restart TempEJBEAR.
  6. In the Web Services Test Client, test your fahrenheitToCelsius and celsiusToFahrenheit methods.

Lesson checkpoint

< Previous | Next >
Icon that indicates the type of topic Tutorial lesson topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: tdejb_exercise14.html