启动WebServices时,遇到的问题

  • Post author:
  • Post category:其他


今天启动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失败,连接超时。

  1. javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://localhost:7630/Webservice/services/WebServiceTest. It failed with:
  2. Connection timed out: connect.
  3. at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:136)
  4. at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:122)
  5. at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:226)
  6. at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:189)
  7. at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:159)
  8. at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:81)
  9. at javax.xml.ws.Service.<init>(Service.java:56)
  10. at com.intel.dcmtest.framework.wsdl.Dcm_Service.<init>(Dcm_Service.java:37)
  11. at com.intel.dcmtest.framework.Utilities.testInitOnMultiServer(Utilities.java:264)
  12. at com.intel.dcmtest.framework.Utilities.testInitOnCentralServer(Utilities.java:155)
  13. at com.intel.dcmtest.functional.api.ExternalGeneralApiTest.setUp(ExternalGeneralApiTest.java:50)
  14. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  15. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  16. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  17. at java.lang.reflect.Method.invoke(Method.java:597)
  18. at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
  19. at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
  20. at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
  21. at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
  22. at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
  23. at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  24. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
  25. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
  26. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
  27. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
  28. Caused by: java.net.ConnectException: Connection timed out: connect
  29. at java.net.PlainSocketImpl.socketConnect(Native Method)
  30. at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
  31. at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
  32. at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
  33. at java.net.Socket.connect(Socket.java:519)
  34. at java.net.Socket.connect(Socket.java:469)
  35. at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
  36. at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
  37. at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
  38. at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
  39. at sun.net.www.http.HttpClient.New(HttpClient.java:306)
  40. at sun.net.www.http.HttpClient.New(HttpClient.java:323)
  41. at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:788)
  42. at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:729)
  43. at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:654)
  44. at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
  45. at java.net.URL.openStream(URL.java:1009)
  46. at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:785)
  47. at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:236)
  48. at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:107)
  49. … 23 more



版权声明:本文为m0_37942145原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。