Creating the web service implementation class, Creating the deployment descriptor – HP Integrity NonStop J-Series User Manual
Page 197

1.
“Creating the Web Service Implementation Class” (page 197)
2.
“Creating the Deployment Descriptor” (page 197)
3.
“Creating an Axis2/Java AAR File” (page 198)
Creating the Web Service Implementation Class
To create the Web Service implementation class, complete the following steps:
1.
Create the TemperatureConverter sub-directory in <My SASH
Home>\axis2\gettingstarted directory
on your Windows system.
2.
Create a Java class TemperatureConverter.java in the TemperatureConverter
directory using any text editor.
3.
Modify the TemperatureConverter.java class to implement c2fConversion and
f2cConversion
(to convert Celsius to Fahrenheit and Fahrenheit to Celsius respectively)
methods.
After incorporating these two methods, the TemperatureConverter.java class appears
as follows:
/**
* Temperature Converter Implementation Class
*/
public class TemperatureConverter {
/**
* util method to convert celsius to fahrenheit
* @param cValue : double value of celsius
* @return calculated value of fahrenheit
*/
public double c2fConversion(double cValue) {
return ((cValue * 9.0)/5.0 )+ 32.0;
}
/**
* util method to convert fahrenheit to celsius
* @param fValue : double value of fahrenheit
* @return calculated value of celsius
*/
public double f2cConversion(double fValue) {
return ((fValue - 32.0) * 5.0) / 9.0;
}
}
Compile the TemperatureConverter.java class using the following steps:
a.
Go to the TemperatureConverter directory using the command:
command prompt> cd
b.
Compile TemperatureConverter.java using the command:
command prompt> javac TemperatureConverter.java
The TemperatureConverter.class file is created in the TemperatureConverter
directory.
Creating the Deployment Descriptor
The services.xml file is the deployment descriptor for any web service deployed under
Axis2/Java. The service deployment descriptor is used by the deployment module to configure
and deploy the service. Therefore, it is essential to reference TemperatureConverter as a web
service in the services.xml file to deploy it in Axis2/Java.
Axis2/Java has a set of built-in MessageReceivers. Some of them can handle only the XML-In
and XML-Out scenario, and these are called RawXML MessageReceivers. There are other
message receivers called RPC MessageReceivers that can handle JavaBeans, simple Java types,
Getting Started with Axis2/Java
197