今天启动WebServices服务的时候,出现Failed to access the WSDL的问题,可以查看http://localhost:7630/Webservice/services/WebServiceTest?wsdl这个地址是打不开的,经过查找和研究发现,是因为wsdl生成客户端的时候,会包含wsdl中的location属性,两者不一致造成的
<wsdlsoap:address location=”http://localhost:7630/Webservice/services/WebServiceTest”/>
可知,在location属性中,生成的客户端代码中会包含其ip/电脑名,主要是生成的XXService.java文件中,其中有一个WebServices标签:
@WebServicesClient(name=”AudioBroadcastingService”,targetNamespace=”http://jcjc”,wsdlLocation=”http://localhost:7630/Webservice/services/WebServiceTest?wsdl”)
二者相比较可知,localhost和work-hp不对应
而@WebServicesClient其中明确定义了wsdl的位置,以及ip/电脑名信息,所以必须要保证wsdl和生成的客户端对应的ip是一致的。
所以原因就在于ip地址错误,系统访问wsdl失败,连接超时。
- javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://localhost:7630/Webservice/services/WebServiceTest. It failed with:
- Connection timed out: connect.
- at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:136)
- at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:122)
- at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:226)
- at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:189)
- at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:159)
- at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:81)
- at javax.xml.ws.Service.<init>(Service.java:56)
- at com.intel.dcmtest.framework.wsdl.Dcm_Service.<init>(Dcm_Service.java:37)
- at com.intel.dcmtest.framework.Utilities.testInitOnMultiServer(Utilities.java:264)
- at com.intel.dcmtest.framework.Utilities.testInitOnCentralServer(Utilities.java:155)
- at com.intel.dcmtest.functional.api.ExternalGeneralApiTest.setUp(ExternalGeneralApiTest.java:50)
- 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:597)
- at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
- at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
- at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
- at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
- at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
- at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
- at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
- at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
- at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
- at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
- 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.Socket.connect(Socket.java:519)
- at java.net.Socket.connect(Socket.java:469)
- at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
- at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
- at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
- at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
- at sun.net.www.http.HttpClient.New(HttpClient.java:306)
- at sun.net.www.http.HttpClient.New(HttpClient.java:323)
- at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:788)
- at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:729)
- at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:654)
- at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
- at java.net.URL.openStream(URL.java:1009)
- at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:785)
- at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:236)
- at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:107)
- … 23 more
版权声明:本文为m0_37942145原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。