我在 JAVA 类中调用 .net webservice,它将从文本文件中读取字符串,然后 UTF8 对其进行编码并将该字符串返回给 JAVA。有时会出现正确的输出。但有时这会给出非法参数异常,即使文本文件中的文本格式正确。以下是我得到的例外:
**SEVERE: Servlet.service() for servlet BaseController threw exception
java.lang.IllegalArgumentException: The char '0x0' after 'return code: 502
<HEAD><TITLE>Parent proxy is not responding</TITLE></HEAD>
<BODY BGCOLOR="white" FGCOLOR="black"><H1>Parent proxy is not responding</H1><HR>
<FONT FACE="Helvetica,Arial"><B>
Description: Parent proxy is not responding</B></FONT>
<HR>
<!-- default "Parent proxy is not responding" response (502) -->
</BODY>
' is not a valid XML character.
at org.apache.axis.components.encoding.AbstractXMLEncoder.encode(AbstractXMLEncoder.java:110)
at org.apache.axis.utils.XMLUtils.xmlEncodeString(XMLUtils.java:131)
at org.apache.axis.utils.DOM2Writer.normalize(DOM2Writer.java:344)
at org.apache.axis.utils.DOM2Writer.print(DOM2Writer.java:246)
at org.apache.axis.utils.DOM2Writer.print(DOM2Writer.java:208)
at org.apache.axis.utils.DOM2Writer.serializeAsXML(DOM2Writer.java:77)
at org.apache.axis.utils.DOM2Writer.serializeAsXML(DOM2Writer.java:60)
at org.apache.axis.utils.DOM2Writer.nodeToString(DOM2Writer.java:49)
at org.apache.axis.utils.XMLUtils.privateElementToString(XMLUtils.java:433)
at org.apache.axis.utils.XMLUtils.ElementToString(XMLUtils.java:442)
at org.apache.axis.utils.XMLUtils.getInnerXMLString(XMLUtils.java:542)
at org.apache.axis.AxisFault.dumpToString(AxisFault.java:388)
at org.apache.axis.AxisFault.printStackTrace(AxisFault.java:789)
at java.lang.Throwable.printStackTrace(Throwable.java:451)
at com.hcl.webservice.BaseController.doPost(BaseController.java:155)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:680)
**
请帮助解决这个问题。提前致谢