標籤: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");
JAX-WS Client Application逾時設定