我有一個Tomcat 7.0網絡服務器,我用它來運行網絡服務。 Web服務框架是CXF 2.5.2。網絡服務器生成嚴重格式化的服務.wsdl
當從Eclipse Web Service Explorer測試Web服務時,所有工作都按預期進行。
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:91)
at javax.xml.ws.Service.<init>(Service.java:77)
at test.Test_Service.<init>(Test_Service.java:43)
at test.Test_TestSOAP_Client.main(Test_TestSOAP_Client.java:47)
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: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'c' (code 99) in start tag Expected a quote at [row,col,system-id]: [1,208,"http://www.example.com:8081/TestWS/services?wsdl"]
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:240)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:191)
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92)
... 6 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'c' (code 99) in start tag Expected a quote at [row,col,system-id]: [1,208,"http://www.example.com:8081/TestWS/services?wsdl"]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639)
at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:3005)
at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2926)
at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2802)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1050)
at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1080)
at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:974)
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:901)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:231)
... 8 more
有趣的部分應該是Unexpected character 'c' (code 99) in start tag Expected a quote at [row,col,system-id]: [1,208,"http://www.example.com:8081/TestWS/services?wsdl"]
消息:但是,從WSDL生成Java客戶端時(使用Eclipse),並運行它,我從服務實現調用super(wsdlLocation, serviceName)
時,遇到下列錯誤。在視察中產生services.wsdl,我發現,這個問題是在元部分:
<meta http-equiv=content-type content="text/html; charset=UTF-8">
content-type
通常應裹成的報價。這是一個已經使用的框架/服務器中的已知錯誤嗎?我能做些什麼來解決這個問題?爲什麼在使用Eclipse Web服務瀏覽器時沒有問題?它是更容錯的(因爲我的Firefox似乎是因爲它也沒有任何問題來顯示生成的wsdl的圖形表示)。
只是轉發到CXF郵件列表。將在這裏發佈更新。 'com.ctc.wstx'似乎是Woodstock XML處理器。這是我無法控制的...... – ubuntudroid 2012-03-20 09:14:22
發現問題,請參閱我的答案。 – ubuntudroid 2012-03-23 11:18:29