AXIS2 设置超时时间无效!!!!!
时间: 2016-07-02来源:开源中国
前景提要
HDC调试需求开发(15万预算),能者速来!>>>
有使用过AXIS2 的大大么?
使用这个动态调用webservice时,由于数据量大,不能再默认的超时时间1分钟内读取完,然后把时间设置为10分钟,发现设置无效,依然是超过1分钟就超时。
求解!!!!
代码: private String invokeSAPItf(List<Map<String,Object>> params,WSItfInfoVO wsinfo) throws BusinessException { ObjectMapper om = new ObjectMapper(); String jsonstr = null; try { om.configure(com.fasterxml.jackson.core.JsonGenerator.Feature.QUOTE_FIELD_NAMES, false); //json 字段名去掉引号 jsonstr = om.writeValueAsString(params); logger.debug("invoke sap param: " + jsonstr); } catch (JsonProcessingException e) { logger.error("调用SAP接口,转换参数出错!", e); throw new BusinessException("调用SAP接口失败",e); } try { ServiceClient sc = new ServiceClient(); Options o = sc.getOptions(); o.setTo(new EndpointReference(wsinfo.getUrl())); o.setAction(wsinfo.getAction()); o.setTimeOutInMilliSeconds(10*60*1000L); // 超时时间 10 分钟 sc.setOptions(o); OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNS = fac.createOMNamespace(wsinfo.getNs(),"ns0"); OMElement method = fac.createOMElement(wsinfo.getMethod(), omNS); OMElement value = fac.createOMElement(new QName(wsinfo.getParamname())); value.setText(jsonstr); method.addChild(value); OMElement retOM = sc.sendReceive(method); // 处理返回值 String result = retOM.getFirstElement().getText(); logger.debug("invoke sap result: " + result); return result; } catch (AxisFault e) { logger.error("调用SAP接口失败!", e); throw new BusinessException("调用SAP接口失败",e); } }




科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行