gpt4 book ai didi

java - 无法从 Web 服务客户端访问本地主机 (TOMCAT) 上的 WSDL

转载 作者:行者123 更新时间:2023-11-28 22:33:58 24 4
gpt4 key购买 nike

我正在尝试用 Java 创建简单的 Web 服务 HelloWorld。我创建方法 HelloWorld。然后使用 CXF 框架我生成网络服务和客户端。服务器是tomcat。但是当我尝试从客户端访问网络服务时,我得到了这个:

Exception in thread "main" javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:150)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:90)
at javax.xml.ws.Service.<init>(Service.java:56)
at sk.fiit.bado.testws.klient.TestWSService.<init>(TestWSService.java:43)
at sk.fiit.bado.testws.klient.TestSEI_TestWSPort_Client.main(TestSEI_TestWSPort_Client.java:48)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:94)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:148)
... 4 more
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'http://localhost:8080/TestService/services/TestWSPort?wsdl'.: java.io.FileNotFoundException: http://localhost:8080/TestService/services/TestWSPort?wsdl
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:244)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:191)
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92)
... 6 more
Caused by: java.io.FileNotFoundException: http://localhost:8080/TestService/services/TestWSPort?wsdl
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1434)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:772)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
... 12 more

我猜这是关于 WSDL 文件的。因为我也无法访问它。帮助将不胜感激。

最佳答案

您的堆栈已经告诉您出了什么问题。找不到 wsdl 文件:

Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'http://localhost:8080/TestService/services/TestWSPort?wsdl'.: java.io.FileNotFoundException: http://localhost:8080/TestService/services/TestWSPort?wsdl

关于java - 无法从 Web 服务客户端访问本地主机 (TOMCAT) 上的 WSDL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9771479/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com