eeijlar
eeijlar

Reputation: 1342

Exception thrown using xwiki and Apache xml-rpc

I am using the following code to update a confluence page:

public void publish() throws IOException {
    XWikiXmlRpcClient rpc = new XWikiXmlRpcClient(CONFLUENCE_URI);

    try {
        rpc.login(USER_NAME, PASSWORD);
        //The info macro would get rendered an info box in the Page
        Page page = new Page();
        page.setSpace("ATF");
        page.setTitle("New Page");
        page.setContent("New Page Created \\\\ {{info}}This is XMLRPC Test{{/info}}");
        page.setParentId("demo UTF Home");

            rpc.storePage(page);
        } catch (XmlRpcException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

}

When I try to run the program, I get the following exception:

org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse server's response: Expected methodResponse element, got html

This looks like a bug in Apache xml-rpc client going by this JIRA: https://issues.apache.org/jira/browse/XMLRPC-159

It says it was fixed in 3.1.2 of the library, I am using 3.1.3.

Anyone seen this before?

Upvotes: 0

Views: 106

Answers (1)

Clemens Klein-Robbenhaar
Clemens Klein-Robbenhaar

Reputation: 3527

Maybe the server really returned HTML; sometimes it simply returns a 200 because something is there that always produces HTML. In that case the bugfix in the XMLRPC-library you have linked to does not apply.

To check for this possibility, you can look into the server access logs for the url of the request and the status code (should be a 200); with this information you can replay the request e.g. in a browser or command line client like wget or curl, and see what is really returned as response.

Upvotes: 1

Related Questions