下面是我的代码,testURL是另外一台机器,我在我的机器上call那个webservice的时候,会抛IOException,请高手指教问题出在哪里?String testURL = "http://10.70.3.181:8080/test/wservices/mytest?wsdl";
URL url = new URL (testURL);
HttpURLConnection connection = (HttpURLConnection)url.openConnection ();
int state = connection.getResponseCode ();

解决方案 »

  1.   

        IOException - if an error occurred connecting to the server.
      

  2.   

    首先在浏览器直接打开http://10.70.3.181:8080/test/wservices/mytest?wsdl,这个链接看看行不行?HttpURLConnection connection = (HttpURLConnection)url.openConnection (); // 打开连接
    这行加一句:connection.connect();   // 进行连接
    int state = connection.getResponseCode ();  // 响应结果状态