【问题标题】:cant access WSDL on localhost(TOMCAT) from client of Web service无法从 Web 服务的客户端访问 localhost(TOMCAT) 上的 WSDL
【发布时间】:2012-03-19 13:53:52
【问题描述】:

我正在尝试在 java 中创建简单的 Web 服务 HelloWorld。我创建方法 HelloWorld。然后使用 CXF 框架生成 Web 服务和客户端。服务器是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 文件的。因为我也无法访问它。帮助将不胜感激。

【问题讨论】:

    标签: java web-services tomcat cxf


    【解决方案1】:

    你的堆栈已经告诉你出了什么问题。找不到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
    

    【讨论】:

    • 不幸的是,FileNotFoundException 并不总是由找不到 WSDL 文件引起。 FNFE 有时可能是由身份验证或用户代理问题引起的。
    猜你喜欢
    • 2012-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-26
    • 1970-01-01
    • 2011-05-09
    • 2015-09-09
    相关资源
    最近更新 更多