有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java将关联数组(Hashmap)作为参数传递给xml rpc

我想从Java中学习XML-RPC,但在将关联数组(Hashmap)作为参数传递时遇到了问题。这是我的密码

 XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
        config.setServerURL(new URL(ServeUrl));
        XmlRpcClient client = new XmlRpcClient();
        client.setConfig(config);
        Map map = new HashMap();
        map.put(Parameter Name, Parameter Value);
        map.put(Parameter Name , Parameter Value);
        Object result = client.execute("method name", map);

共 (1) 个答案

  1. # 1 楼答案

    HashMap需要包装在对象数组中:

    Object result = client.execute("method name", new Object [] {map});