标签:service
1、 String requestUrl = "http://" + urlStr + "/VipPushData/SyncServiceImplPort?wsdl"; try { URL baseUrl = SyncServiceImplService.class.getResource("."); URL url = new URL(baseUrl, requestUrl); SyncServiceImplService service = new SyncServiceImplService(url, new QName( "http://webservice.vip.centaur.com/", "SyncServiceImplService")); SyncServiceImplDelegate portType = service.getSyncServiceImplPort(); ((BindingProvider) portType).getRequestContext().put("com.sun.xml.ws.request.timeout", Integer.valueOf(5000)); ((BindingProvider) portType).getRequestContext().put("com.sun.xml.ws.connect.timeout", Integer.valueOf(10000)); return portType.sync(data); } catch (Exception e) { throw new FaiureException(MessageFormat.format("调用【{0}】发生异常,重试次数{1},异常信息:{2}", requestUrl, 0, e.getMessage())); } 设置超时,不生效。 2、解决方案: 设置: System.setProperty("sun.net.client.defaultConnectTimeout", "10000"); System.setProperty("sun.net.client.defaultReadTimeout", "10000");
标签:service
原文地址:http://332532.blog.51cto.com/322532/1826495