beautypg.com

Creating the deployment descriptor – HP Integrity NonStop H-Series User Manual

Page 203

background image

/**
* 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 \axis2\gettingstarted\TemperatureConverter

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 any kind of JavaBeans, simple

Java types, and XML. The

RPC MessageReceivers

message receiver is used for the sample

TemperatureConverter web service.

To create the deployment descriptor, complete the following steps:

1.

Create a new directory named

META-INF

in the

<My SASH

Home>\axis2\gettingstarted\TemperatureConverter

directory on your Windows

system.

2.

Create the

services.xml

in

META-INF

directory (using any text editor) on your Windows

system. If you do not want to create your own deployment descriptor file, you can use the
following lines of code to create your

services.xml

file.

Overview of TemperatureConverter

203

This manual is related to the following products: