Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Java中Ping WSDL_Java_Wsdl_Ping - Fatal编程技术网

如何在Java中Ping WSDL

如何在Java中Ping WSDL,java,wsdl,ping,Java,Wsdl,Ping,如何在Java中为WSDL执行Ping 我已经试过了: InetAddress.getByname(my_wsdl).isReachable(3000); 但是没用。试试这个 private boolean isWSDLAvailable(String wsdlAddr) { HttpURLConnection c = null; try { URL u = new URL(wsdlAddr); c = (Htt

如何在Java中为WSDL执行Ping

我已经试过了:

InetAddress.getByname(my_wsdl).isReachable(3000);
但是没用。

试试这个

 private boolean isWSDLAvailable(String wsdlAddr) {
        HttpURLConnection c = null;
        try {
            URL u = new URL(wsdlAddr);
            c = (HttpURLConnection) u.openConnection();
            c.setRequestMethod("HEAD");
            c.getInputStream();
            return c.getResponseCode() == 200;
        } catch (Exception e) {
            return false;
        } finally {
            if (c != null) c.disconnect();
        }    
}

不能ping文件。您是否询问如何“ping”您的web服务端点?您是否询问验证该服务是否可用?如果是这样,只需将
?wsdl
附加到服务的URL中即可。