gpt4 book ai didi

java - Java 中的 XML RPC 问题——无法创建 XML 解析 : org. xml.sax.SaxNotRecognizedException

转载 作者:行者123 更新时间:2023-11-30 04:40:18 25 4
gpt4 key购买 nike

我对 Java 和 Android 框架有些陌生,但我认为我正在做的事情并不复杂。有一个返回结构数组(关联数组的数组)的 LAMP XML-RPC 服务器,我一直无法在我的 Android 项目中成功接收到响应。

我正在使用 apache xml-rpc 库:

import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;

这是代码。 XML-RPC 服务器是本地安装。我被部分难住了,因为在使用此处找到的 XML-RPC 调试器工具时,我已经能够很好地获得响应:http://xmlrpc-debug.sourceforge.net/

        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

try {
config.setServerURL(new URL("http://192.168.1.125:8886/api"));
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
// shouldn't need this because URL is hardcoded
e.printStackTrace();
}

XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);

//The only param is userId. Hardcoded in 1, which is a valid id.
Vector<Integer> params = new Vector<Integer>();
params.add( 1 );

try {
Object xmlrpc_reponse = client.execute("Api.getUser", params);
//theres more code here to handle the object and return the result,
//but it never gets past the above line before triggering the exception
} catch (XmlRpcException e) {
Log.w("xmlrpcproblem", e.getMessage());
}

XmlRpcException 被消息捕获:

Unable to create the XML parse: org.xml.sax.SaxNotRecognizedException: http://xml.org/sax/features/external-parameters-entities

最佳答案

看起来像this .

关于java - Java 中的 XML RPC 问题——无法创建 XML 解析 : org. xml.sax.SaxNotRecognizedException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6089432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com