开发者

SSL WS URL Creation from configuration file in static

开发者_开发问答

I have a application that conect to a web service with SSL. In the static of the class that make the conecction to the web server I have this:

static {
    URL url = null;
    try {
        URL baseUrl;
        baseUrl = ar.com.cfa.xmlns.wsevaluartdm.WSEvaluarTDM.class.getResource(".");
        url = new URL(baseUrl, "https://www.site.com/WS.asmx?WSDL");
    } catch (MalformedURLException e) {
        logger.warning("Failed to create URL for the wsdl Location: 'https://www.site.com/WS.asmx?WSDL', retrying as a local file");
        logger.warning(e.getMessage());
    }
    WSEVALUARTDM_WSDL_LOCATION = url;
}

The URL("https://www.site.com/WS.asmx?WSDL") change every 15 days, so I need to put that url in a configuration file.But I can't because if I try to put a variable in static{} the error "non-static variable name cannot be referenced from a static context" shows up. What can I do?


seems like your static initializer is accessing an instance variable (possibly logger, WSEVALUARTDM_WSDL_LOCATION).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜