axis2 Version: 1.6.2
import java.rmi.RemoteException;
import nc.pubitf.para.SysInitQuery;
import nc.vo.pub.BusinessException;
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.Options;
import org.apache.axis2.transport.http.HTTPConstants;
import org.tempuri.HQSWcfServiceCallHQSWcfServiceCallSoapStub;
import com.yonyou.yh.nhis.bd.util.SysConfigParamUtil;
import com.yonyouhealth.uaph.framework.comm.util.StringUtils;
public class ChinaShineUtils {
Stub static HQSWcfServiceCallHQSWcfServiceCallSoapStub Private;
Private static HQSWcfServiceCallHQSWcfServiceCallSoapStub getServiceStub () throws AxisFault, BusinessException {
the try {
Stub Stub new new HQSWcfServiceCallHQSWcfServiceCallSoapStub = null == ():? Stub;
.. Stub _getServiceClient Options Options = () getOptions ();
options.setProperty (HTTPConstants .CONNECTION_TIMEOUT, 2 * 1000); // set the server timeout method (in milliseconds)
options.setProperty (HTTPConstants.SO_TIMEOUT, 1000 *. 3); // set the timeout waiting customer connections (in milliseconds)
Stub. _getServiceClient () setOptions (options); // set.
} the catch (The AxisFault E) {
the throw new new The AxisFault ( "interface call times out, the interface returns the information:" + e.getMessage ());
}catch(Exception e){
throw new BusinessException("接口调用失败,接口返回信息:"+ e.getMessage());
}
return stub;
}
private static HQSWcfServiceCallHQSWcfServiceCallSoapStub getServiceStub(String pk_group) throws AxisFault, BusinessException{
try {
if(StringUtils.hasText(pk_group)){
String url = SysInitQuery.getParaString(pk_group, "NHISPV014");
if(StringUtils.hasText(url) ){
stub = null==stub? new HQSWcfServiceCallHQSWcfServiceCallSoapStub(url) : stub;
String conn_timeout_str = new SysConfigParamUtil().getPubSysInitByGroup(pk_group, "NHISPV022");
? Connection_timeout Integer = StringUtils.hasText (conn_timeout_str) Integer.valueOf (conn_timeout_str): 2000;
. = String so_timeout_str new new SysConfigParamUtil () getPubSysInitByGroup (pk_group, "NHISPV023");
? = Integer SO_TIMEOUT StringUtils.hasText (so_timeout_str) Integer.valueOf ( so_timeout_str): 3000;
the Options Options stub._getServiceClient = () the getOptions ();.
options.setProperty (HTTPConstants.CONNECTION_TIMEOUT, connection_timeout); // set the server timeout method (in milliseconds)
options.setProperty (HTTPConstants.SO_TIMEOUT, so_timeout); // wait timeout connected clients (in milliseconds)
stub._getServiceClient () the setOptions (Options);. // set
} else {
= getServiceStub Stub ();
}
} the else {
Stub getServiceStub = ();
}
} the catch (The AxisFault E) {
the throw new new The AxisFault ( "interface call times out, the interface returns the information:" + e.getMessage ());
} the catch (Exception E) {
the throw new new BusinessException ( "call failed interfaces, the interface information is returned:" + e.getMessage ());
}
return Stub;
}