Implement the Server Code
Exercise
Building on the previous labs, in this exercise you will implement the server code for the web service.
Prerequisites
Objectives
- Discover how to implement the server code.
Setup Tasks
Open the CalculatorSoapBindingImpl.java file that you created previously.
Or download the file (JAVA).
Tasks
- Modify the file to resemble the following code fragment:
package calculator.ws;
public class CalculatorSoapBindingImpl implements calculator.ws.Calculator {
public double add(double in0, double in1) throws java.rmi.RemoteException
{
return in0 + in1;
}
public double subtract(double in0, double in1)throws java.rmi.RemoteException
{
return in0 – in1;
}
}
- Save the file.
- Compile the server code.
Check Your Work
Download the completed code (JAVA).
Additional Labs
Go to the next exercise in “Building a Calculator Web Service Using Apache Tomcat/Axis”,
Compile, Publish and Test the Web Service.
Back to the Developer Lab Main Menu
|