日期:2014-05-17 浏览次数:20890 次
public class AxisClient {
public static void main(String[] args) throws Exception {
String targetEndPoint = "http://localhost:8080/Asix2Demo/services/HelloWorld";
Service ser = new Service();
try {
Call call = (Call) ser.createCall();
call.setTargetEndpointAddress(targetEndPoint);
call.setOperationName(new QName(targetEndPoint, "hello" ));
call.setOperation("hello");
String result = (String) call.invoke(new Object[] { new String("张三") });
System.out.println("result=" + result);
//call.setOperation("add");
//int addResult = (Integer) call.invoke(new Object[] {new Integer(1), new Integer(1) });
//System.out.println("addResult=" + addResult);
} catch (ServiceException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}
------解决方案--------------------
//直接调url就可以吧?
String para = "";//参数
String url = "http://192.198.1.1:80/Database.asmx/Method?para="+para;
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder builder=factory.newDocumentBuilder();
org.w3c.dom.Document doc = builder.parse(url);
org.w3c.dom.NodeList list =doc.getElementsByTagName("Table");
//然后循环去读List吧。。。
//类似于这样//list.item(i).getChildNodes().item(1).getChildNodes().item(0).getNodeValue()