我正在使用我的
XML-RPC服务使用Apache XML-RPC库,但在回应XML-RPC有垃圾字符,所以库不能解析结果
这里是我的XML-RPC程序:
import java.net.URL;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
public class XMLRpcExample {
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
XmlRpcClientConfigImpl cf = new XmlRpcClientConfigImpl();
cf.setServerURL(new URL("/xmlrpc/object"));
cf.setBasicUserName("admin");
cf.setBasicPassword("m_demo");
cf.setConnectionTimeout(60000);
XmlRpcClient client = new XmlRpcClient();
client.setConfig(cf);
Object[] params = new Object[] {"dbname",1,"m_demo","res.partner","partner_sync_openerp","kapil5drd@bxiz","22"};
String s =(String)client.execute("execute", params);
System.out.println(s);
}
}
但是我收到这个错误的回复,看起来像这样:
[Fatal Error] :16:16: An invalid XML character (Unicode: 0xc) was found in the element content of the document.
Exception in thread "main" org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse server's response: An invalid XML character (Unicode: 0xc) was found in the element content of the document.
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:202)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:165)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:125)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:137)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:126)
at XMLRpcExample.main(XMLRpcExample.java:21)
Caused by: org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 16; An invalid XML character (Unicode: 0xc) was found in the element content of the document.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1237)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:551)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:200)
... 8 more
XML-RPC在响应中给出一个垃圾字符.
而图书馆本身也无法解析答案.
所以这意味着Apache XML-RPC库自身无法解析响应.
任何身体能帮助我,我需要做什么吗?
我也试图通过互联网解决这个问题,但我无法解决这个问题.