java怎么判断webservice接口可用

2024-12-02 07:18:51
推荐回答(1个)
回答1:

发个HTTP请求,看看返回结果。
String url = "wsurl...?wsdl";
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
if(HttpURLConnection.HTTP_OK == connection.getResponseCode()){
//通了
}