beautypg.com

Adding dependency jar files, Adding dependency, Files – HP Integrity NonStop H-Series User Manual

Page 214

background image

public static void main(String[] args) throws AxisFault {

ServiceClient client = new ServiceClient();
// create option object
Options opts = new Options();
// setting target EPR
opts
.setTo(new EndpointReference(
"http://:
/servlet_jsp/axis2/services/TemperatureConverter"));

// 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());

System.out.println(res1);
System.out.println(res2);

}

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;

}

public static OMElement createPayLoad2() {
OMFactory fac = OMAbstractFactory.getOMFactory();
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;

}
}

Adding Dependency

JAR

Files

Add the following Axis2/Java dependency

JAR

files in the Java Build Path of the

AxisClient

project to compile and link the project.

Table 9-1 Axis2/Java Dependency

JAR

Files

Source Location

Dependency

JAR

Files

<Axis2/Java Home>/lib

activation-1.1.jar

<Axis2/Java Home>/lib

annogen-0.1.0.jar

214

Getting Started with Axis2/Java

This manual is related to the following products: