尝试调用一个天气预报的webservice : http://www.webservicex.net/globalweather.asmx但是运行的时候,一直都连接不上,麻烦大家帮我看看问题在哪,多谢。测试的客户端代码为:红色部分是我IE设置的代理package net.webservicex.www;import java.util.Properties;public class WeatherTest {
static public void main(String[] args)throws Exception {

Properties prop = System.getProperties(); 
        prop.put("http.proxyHost","139.24.236.123"); 
        prop.put("http.proxyPort","8080"); 
   
     
String endpoint =  "http://www.webservicex.net/globalweather.asmx";
GlobalWeatherStub stub = new GlobalWeatherStub(endpoint); GlobalWeatherStub.GetCitiesByCountry city = new GlobalWeatherStub.GetCitiesByCountry();
city.setCountryName("China");
stub.GetCitiesByCountry(city);

System.out.println(stub.GetCitiesByCountry(city));  }
}提示的错误信息如下:
2008-6-27 17:03:31 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
信息: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: connect
2008-6-27 17:03:31 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
信息: Retrying request
2008-6-27 17:03:52 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
信息: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: connect
2008-6-27 17:03:52 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
信息: Retrying request
2008-6-27 17:04:13 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
信息: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: connect
2008-6-27 17:04:13 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
信息: Retrying request
Exception in thread "main" org.apache.axis2.AxisFault: Connection timed out: connect; nested exception is: 
java.net.ConnectException: Connection timed out: connect; nested exception is: 
org.apache.axis2.AxisFault: Connection timed out: connect; nested exception is: 
java.net.ConnectException: Connection timed out: connect
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:670)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:365)
at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:295)
at net.webservicex.www.GlobalWeatherStub.GetCitiesByCountry(GlobalWeatherStub.java:151)
at net.webservicex.www.WeatherTest.main(WeatherTest.java:17)
Caused by: org.apache.axis2.AxisFault: Connection timed out: connect; nested exception is: 
java.net.ConnectException: Connection timed out: connect
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:340)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:205)
... 5 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:139)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:124)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:534)
at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:119)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:334)
... 6 more

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【ivyyuan1】截止到2008-06-27 17:09:09的历史汇总数据(不包括此帖):
    发帖数:2                  发帖分:40                 
    结贴数:0                  结贴分:0                  
    未结数:2                  未结分:40                 
    结贴率:0.00  %            结分率:0.00  %            
    如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html