最近公司搬新办公室,网络不是很稳定.跑以前做好的webservice服务发现传输文件超时,报java.net.SocketTimeoutException: Read timed out错误.修改代码:
try {
binding = (com.landray.kmss.sys.webservice.reportattach.ReportAttachServiceSoapBindingStub)
new com.landray.kmss.sys.webservice.reportattach.ReportAttachServiceLocator().getReportAttachService();
}
catch (javax.xml.rpc.ServiceException jre) {
if(jre.getLinkedCause()!=null)
jre.getLinkedCause().printStackTrace();
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
// Time out after a minute
binding.setTimeout(180000);
把超时设定延长,搞定.
本文介绍了解决WebService在传输文件过程中出现的超时问题。通过调整Java代码中的超时设定,将超时时间延长至三分钟,成功解决了传输过程中的SocketTimeoutException错误。
327

被折叠的 条评论
为什么被折叠?



