小编kap*_*ara的帖子

Apache的Java XMLRPC库

我正在使用我的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 …

java xml-rpc

13
推荐指数
1
解决办法
2237
查看次数

标签 统计

java ×1

xml-rpc ×1