@WebServiceClient注解,wsdlLocation 可配置

@WebServiceClient(name = "SurveyInfoService", targetNamespace = "http://webservice.test.com", wsdlLocation = "http://192.168.7.126:8080/test/CaseSurvey/services/SurveyInfoService?wsdl")
等价于:

public class SurveyInfoService extends Service {

    // 接口地址从配置文件中获取

    private static String chcgWebServiceUrl = PropertyUtils.getProperty("chcg.webservice.url");
    private final static URL SURVEYINFOSERVICE_WSDL_LOCATION;
    private final static Logger logger = Logger
            .getLogger(com.wonders.szsp.port.survey.SurveyInfoService.class
                    .getName());

    static {
        URL url = null;
        try {
            URL baseUrl;
            baseUrl = com.test.port.survey.SurveyInfoService.class
                    .getResource(".");
            url = new URL(baseUrl,chcgWebServiceUrl+"?wsdl");
        } catch (MalformedURLException e) {
            logger.warning(e.getMessage());
        }
        SURVEYINFOSERVICE_WSDL_LOCATION = url;
    }

    public SurveyInfoService() {
        super(SURVEYINFOSERVICE_WSDL_LOCATION, new QName(
                "http://webservice.test.com", "SurveyInfoService"));
    }

}

 

你可能感兴趣的:(@WebServiceClient注解,wsdlLocation 可配置)