求高手指教

biangege87v5 2011-11-21 10:46:00
关于Call.invoke()异常,怎么解决?

;nested exeception is :
java.net.ConnectException:Connection timed out:connect
...全文
134 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
qybao 2011-11-21
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 biangege87v5 的回复:]
String url="http://localhost:9999/yanzhengma";这样就成


1
[Ljava.lang.String;@472d48
; nested exception is:
org.xml.sax.SAXException: Bad envelope tag: html
123
[/Quote]
这个是标签不完整,所以sax检测通不过
biangege87v5 2011-11-21
  • 打赏
  • 举报
回复
String url="http://localhost:9999/yanzhengma";这样就成


1
[Ljava.lang.String;@472d48
; nested exception is:
org.xml.sax.SAXException: Bad envelope tag: html
123
biangege87v5 2011-11-21
  • 打赏
  • 举报
回复
恩,确实是这call.setTargetEndpointAddress(new URL(url));我把url="www.baidu.com"就又出异常,跳过它就OK,但到invoke还会错,如何破呢?大侠
biangege87v5 2011-11-21
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 pl3121605999 的回复:]
就是连接超时么。。你看看。。你访问什么造成的。。看地址是否正确
[/Quote]


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\"?>" ;
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);
System.out.println(paras.length);System.out.println(paras);
result = (String) call.invoke(paras);

System.out.println(result+5);

} catch (Exception e) {
System.out.println(e.getMessage());
System.out.println(123);
}
call.setTargetEndpointAddress(new URL(url));
是这个的问题吗?
pl3121605999 2011-11-21
  • 打赏
  • 举报
回复
就是连接超时么。。你看看。。你访问什么造成的。。看地址是否正确
biangege87v5 2011-11-21
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 qybao 的回复:]
引用 4 楼 biangege87v5 的回复:
String url="http://localhost:9999/yanzhengma";这样就成


1
[Ljava.lang.String;@472d48
; nested exception is:
org.xml.sax.SAXException: Bad envelope tag: html
123

这个是标签不……
[/Quote]


标签完整的啊
biangege87v5 2011-11-21
  • 打赏
  • 举报
回复
String url = "http://10.158.250.80:6001/web/services/ZdglService";这个是服务器上的地址,那怎样把它弄到本地来访问?

51,408

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧