package com.dareway.webservice.client;
import java.net.URL;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class ClientDemo4Axis {
public static void main(String[] args) {
String url = "http://10.158.250.80:6001/web/services/ZdglService";
String port = "sendBillInfo";
String xml = "<?xml version=\"1.0\" encoding=\"GBK\"?>" +
"<billInfo>" +
"<billId>140000000321</billId>" +
"<rtuZcbh>1400004551</rtuZcbh>" +
"<rtuName>北郊热电厂</rtuName>" +
"<dwbh>DZ0001</dwbh>" +
"<czbh>1402000017</czbh>" +
"<khbh>11</khbh>" +
"<rtuDzm>54014573</rtuDzm>" +
"<phoneNum>15953774605</phoneNum>" +
"<rtuGybb>01</rtuGybb>" +
"<rtuType>2</rtuType>" +
"<malfunctionAdd>北郊</malfunctionAdd>" +
"<malfunction>离线</malfunction>" +
"</billInfo>";
String[] paraNames = new String[]{"billInfoXML"};
Object[] paras = new String[]{xml};
String result = "";
try {
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(url));
call.setOperationName(port);
if (paras.length < paraNames.length) {
Object[] tmpparas = paras;
paras = new Object[paraNames.length];
for (int i = 0; i < paras.length; i++) {
paras[i] = tmpparas[i];
}
for (int i = paras.length; i < paraNames.length; i++) {
paras[i] = (Object) "";
}
}
result = (String) call.invoke(paras);
System.out.println(result);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
我反编译了org.apache.axis.client.Call 跟 org.apache.axis.client.Service 坑爹啊!那里面代码更看不懂啊,层层深入啊,谁能大概告诉我 这两个类是做什么用的 还有就是上面那断代码是什么意思啊,应该很简单,但我不懂啊 谁能教教我啊!!
还有为什么运行这个程序 不会立即出现错误,但是一会就 出现 ; nested exception is:
java.net.ConnectException: Connection timed out: connect
什么情况啊 啊
------解决方案--------------------------------------------------------
http://10.158.250.80:6001/web/services/ZdglService?wsdl
看能打开不