我正在尝试学习webservices。我在本地计算机上使用wsimport生成了一个客户端。当我在RAD中设置工作区并运行应用程序即时到达异常时,我在谷歌搜索了类似的问题,但我无法找到解决方案,所以如果有人可以解释这个问题以便我可以移动它真的会帮助我学习weservices前进。当我在浏览器中使用WSDL URL时,我能够毫无问题地访问它。
Exception in thread "main" javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://www.webservicex.com/geoipservice.asmx?WSDL. It failed with:
Got Connection refused: connect while opening stream from http://www.webservicex.com/geoipservice.asmx?WSDL.
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:185)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:167)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:132)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:270)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:233)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:181)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:113)
at javax.xml.ws.Service.<init>(Service.java:88)
at net.webservicex.GeoIPService.<init>(GeoIPService.java:39)
at net.webservicex.Test.main(Test.java:11)
我的代码如下:
package net.webservicex;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
GeoIPService obj = new GeoIPService();
GeoIPServiceSoap obj1 = obj.getGeoIPServiceSoap();
GeoIP obj3 = new GeoIP();
obj3 = obj1.getGeoIP("www.google.com");
System.out.println(obj3.getIP());
}
}