Exercise 1.4: Implement the temperature conversion methods
Before you begin, you must complete Exercise 1.3: Create the Web service.
Implementing the temperature conversion methods (optional)
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.
- Switch to the resource perspective if you are not already using
it.
- In the Navigator view, select ConvertTemperatureSoapBindingImpl.java under TempEJB > ejbModule > samples.
- Locate the fahrenheitToCelsius method and replace
the current implementation with the following: return (fahrenheitValue - 32) / 9 * 5;
- Locate the celsiusToFahrenheit method and replace
the current implementation with the following: return (celsiusValue * 9 / 5) + 32;

- Save your updates by clicking File > Save.
- Restart the EAR by right-clicking WebSphere Application Server v6.0
in the Server view and clicking Restart
project > TempEAR.
- Click Run > Launch
the Web Services Explorer from the main menu bar
and repeat the instructions from the previous section to test your fahrenheitToCelsius and celsiusToFahrenheit methods.
Now you are ready to begin Exercise 1.5: Validate the Web service traffic WS-I compliance.