Modifying the class file of the client – HP Integrity NonStop J-Series User Manual
Page 207
![background image](/manuals/397993/207/background.png)
Figure 93 New Java Package Dialog Box
4.
Click Finish.
The class files under the Java package are created.
Modifying the Class File of the Client
To modify the newly created TemperatureConverterClient.java class file, complete the
following steps:
1.
Create an instance of the ServiceClient under the main() method.
ServiceClient client = new ServiceClient();
2.
Create the following two OMElement methods for payload (request SOAP body or the
message) under the main() method:
•
createPayLoad1()
: For converting Celsius to Fahrenheit
•
createPayLoad2()
: For converting Fahrenheit to Celsius
NOTE:
OMElement
is the Axis2/Java representation of XML.
The following code creates the above-mentioned OMElement methods.
public static OMElement createPayLoad1() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2",
"axis2");
OMElement method = fac.createOMElement("c2fConversion", omNs);
OMElement element = fac.createOMElement("value", omNs);
element.setText("4");
method.addChild(element);
return method;
Getting Started with Axis2/Java 207