javax.xml.ws.Service如何设置超时时间

javax.xml.ws.Service如何设置超时时间?

创建GeneralWeb实力的时候直接进行服务连接
有时候服务器没有响应了,程序就吊在这里没有响应

我需要设置连接超时时间和请求数据超时时间,请问如何设置?

 @WebServiceClient(name = "GeneralWeb", targetNamespace = "xxx", wsdlLocation = "xxx.wsdl")
public class GeneralWeb
extends Service
{

private final static URL GENERALWEB_WSDL_LOCATION;
private final static Logger logger = Logger.getLogger(com.goodcol.webservice.oa.GeneralWeb.class.getName());

static {
    URL url = null;
    try {
        URL baseUrl;
        baseUrl = com.goodcol.webservice.oa.GeneralWeb.class.getResource(".");
        //url = new URL(baseUrl, "http://10.100.201.125:7003/defaultroot/xfservices/GeneralWeb?wsdl");
        url = new URL(baseUrl, PropertiesContent.get("pcoaurl"));
    } catch (MalformedURLException e) {
        logger.warning("Failed to create URL for the wsdl Location: "+PropertiesContent.get("pcoaurl")+", retrying as a local file");
        logger.warning(e.getMessage());
    }
    GENERALWEB_WSDL_LOCATION = url;
}

public GeneralWeb(URL wsdlLocation, QName serviceName) {
    super(wsdlLocation, serviceName);
}

public GeneralWeb() {
    super(GENERALWEB_WSDL_LOCATION, new QName("http://com.whir.service/GeneralWeb", "GeneralWeb"));
}

@WebEndpoint(name  = "GeneralWebHttpPort")
public GeneralWebPortType getGeneralWebHttpPort() {
    return super.getPort(new QName("http://com.whir.service/GeneralWeb", "GeneralWebHttpPort"),     GeneralWebPortType.class);
}

 @WebEndpoint(name = "GeneralWebHttpPort")
public GeneralWebPortType getGeneralWebHttpPort(WebServiceFeature... features) {
    return super.getPort(new QName("http://com.whir.service/GeneralWeb", "GeneralWebHttpPort"), GeneralWebPortType.class, features);
}

}
求大神指点。。。。

可以使用URLConnection的setSoTimeout,具体得可以参考:
https://blog.csdn.net/samyang1/article/details/79309223
类似的解决百度多的是。