zno2

Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers

1)错误信息

Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
    at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:149)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:90)
    at javax.xml.ws.Service.<init>(Service.java:67)
    at javax.xml.ws.Service.create(Service.java:691)
    at com.bull.eris.cmn.ds.DSIFPortType_DSIFPort_Client.signPDF(DSIFPortType_DSIFPort_Client.java:60)
    ... 17 more
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
    at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:93)
    at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
    at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
    ... 21 more
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers
 at javax.xml.stream.SerializableLocation@66b866b8
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:235)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:186)
    at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91)
    ... 23 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers
 at javax.xml.stream.SerializableLocation@66b866b8
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:612)
    at com.ctc.wstx.sr.BasicStreamReader.startDTD(BasicStreamReader.java:2444)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromPrologBang(BasicStreamReader.java:2360)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2020)
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1106)
    at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1042)
    at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:939)
    at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:866)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:226)
    ... 25 more

 

2) 原因是 访问?wsdl 地址时返回了500错误信息

此时的response body 是这样的:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
<HTML>
<HEAD>
<TITLE>Error 500--Internal Server Error</TITLE>
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 500--Internal Server Error</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3>
</FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.5.1 500 Internal Server Error</H4>
</FONT><P><FONT FACE="Courier New">The server encountered an unexpected condition which prevented it from fulfilling the request.</FONT></P>
</FONT></TD></TR>
</TABLE>

</BODY>
</HTML>

这块说明是在检查 DOCTYPE 的时候,需要时这种格式

PUBLIC SYSTEM

也就是说:PUBLIC 和 SYSTEM 之间只能是空格,不能是别的双引号之类

这块校验就是上面说的必须出席

结论就是:

访问?wsdl 时返回了错误的xml文档,代码中需要校验返回的文档。(浏览器打开时很明显文档返回错误,接下来只需要查查为啥不能提供服务)

 

posted on 2023-06-06 13:19  zno2  阅读(297)  评论(0编辑  收藏  举报

导航