XML-RPC在JAVA中连接汇合

时间:2014-03-21 12:02:19

标签: java xml-rpc

我必须使用XML-RPC将图片上传到JAVA中的汇合。

JAVA CODE

import java.util.Vector;
import java.util.Hashtable;
import helma.xmlrpc.*;
import java.util.Arrays;

public class test {

    // The location of our server.
    private final static String server_url =
        "http://confluence.xyz.com:8080/rpc/xmlrpc";

    public static void main (String [] args) {
        try {

            // Create an object to represent our server.
            XmlRpcClient server = new XmlRpcClient(server_url);

            Vector<Object> params = new Vector<Object>();
            params.add("username");
            params.add("pass");

            String token = (String) server.execute("confluence2.login", params );
            System.out.println(token);
        }
         catch (Exception exception) {
            System.err.println("JavaClient: " + exception.toString());
        }
    }
}

我收到错误

JavaClient: java.io.IOException: SAX driver not found: org.apache.xerces.parsers.S

1 个答案:

答案 0 :(得分:1)

您需要为此添加额外的xercesImpl-2.2.1.jar。如果您使用的是maven,则只需添加xercesImpl maven dependency,如下所示:

<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.2.1</version>
</dependency>

希望它有所帮助!