锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
jre 1.5 or 1.6, tomcat 5525, eclipse, axis2
and in eclipse preferences set tomcat to web server, set jre env and set axis2's runtime
2. create a java project and add axis2 runtime library to its build library
test ws client sample code:
public class TestSms
{
private static EndpointReference targetEPR = new EndpointReference(
"http://cdl:8080/axis2/services/Version");
public static OMElement getGetLeftElement(){
OMFactory fac=OMAbstractFactory.getOMFactory();
OMNamespace omNs=fac.createOMNamespace("姝ゅ濉啓WS鐨勫懡鍚嶇┖闂?,"hw");
OMElement method=fac.createOMElement("WS 鏂規硶鍚?,omNs);
OMElement value = fac.createOMElement("鍙傛暟涓", omNs);
value.addChild(fac.createOMText(value, "鍊間竴"));
method.addChild(value);
value = fac.createOMElement("鍙傛暟浜?, omNs);
value.addChild(fac.createOMText(value, "鍊?"));
method.addChild(value);
return method;
}
public static void main(String[] args){
try{
Options options=new Options();
options.setTo(targetEPR);
options.setAction("鍛藉悕絀洪棿/WS 鏂規硶鍚?);
ServiceClient sender=new ServiceClient();
sender.setOptions(options);
OMElement sayHello=TestSms.getGetLeftElement();
//WSDLConstants.
OMElement result=sender.sendReceive(sayHello);
OMElement elem = result.getFirstElement();
System.out.println(elem.getText());
//System.out.println(result);
}
catch(Exception axisFault){
axisFault.printStackTrace();
}
}
}