Webservice客户端设置超时时间

  • Sun Jre 设置超时时间
  • Map<String, Object> ctxt = ((BindingProvider) service)
    .getRequestContext();
    ctxt.put("com.sun.xml.internal.ws.connect.timeout", 60 * 1000);
    ctxt.put("com.sun.xml.internal.ws.request.timeout", 60 * 1000);
  • Cxf客户端设置超时时间
  • Client proxy = ClientProxy.getClient(service); 
    HTTPConduit conduit = (HTTPConduit) proxy.getConduit(); 
    HTTPClientPolicy policy = new HTTPClientPolicy(); 
    policy.setConnectionTimeout(3000); 
    policy.setReceiveTimeout(5000); 
    conduit.setClient(policy); 

你可能感兴趣的:(webservice)