HP Integrity NonStop H-Series User Manual
Page 213

OMNamespace omNs = fac.createOMNamespace(
"http://ws.apache.org/axis2", "axis2");
OMElement method = fac.createOMElement("f2cConversion", omNs);
OMElement element = fac.createOMElement("value", omNs);
element.setText("4");
method.addChild(element);
return method;
3.
Create a metadata object called Options under the
main()
method and set it to ServiceClient.
NOTE:
The metadata object Options contains the target End Point Reference (EPR), SOAP
action, and transport data properties to configure the client for the service invocation.
Options opts = new Options();
opts.setTo(new EndpointReference("http://
/servlet_jsp/axis2/services/TemperatureConverter"));
NOTE:
Remember to replace
<IP address of iTP WebServer>
with the IP Address
and
web service is running.
4.
Set the SOAP action, provided in the WSDL file, of the TemperatureConverter web service,
by adding the following code.
// Setting action ,and which can be found from the wsdl of the service
opts.setAction("urn:c2fConversion");
// setting created option into service client
client.setOptions(opts);
OMElement res1 = client.sendReceive(createPayLoad1());
opts.setAction("urn:f2cConversion");
OMElement res2 = client.sendReceive(createPayLoad2());
5.
Add the following
import
statements for the objects used in the
TemperatureConverterClient.java
class
:
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.ServiceClient;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
After incorporating these changes, your
TemperatureConverterClient.java
file must
appear as:
package com.hp.client;
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.ServiceClient;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
public class TemperatureConverterClient {
Overview of TemperatureConverter
213