Search code examples
javaxmlxml-rpc

Passing associative array(Hashmap) as parameter to xml rpc


I want to XML-RPC from Java,I am facing problem while passing associative array(Hashmap) as parameter.Here is my code.

 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);

Solution

  • The HashMap needs to be wrapped in an object array:

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