解决SAXParseException: Premature end of file

解决SAXParseException: Premature end of file

 

我是用xmlrpcClient发送XML时出的这个错误

 

提示:org.xml.sax.SAXParseException: Premature end of file.

现象:用MiniSniffer抓包后发现,发出去的http标头,相比用其它工具正常发出的HTTP,少了个

 

Accept: */*  这个标头...返回的XML则没有了,成空了。。我想是因为缺少这个ACCEPT标头所致的。。

 

问题代码:config = new XmlRpcClientConfigImpl();

 

//ati 2012.7.12

config.setEnabledForExtensions(Boolean.TRUE);

 

解决:config.setEnabledForExtensions(false);

 

//EnabledForExtensions这个属性高为FALSE。。这样发出去的标头就有accept了。。。

 

原文地址:https://www.cnblogs.com/attilax/p/15199971.html