Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to use the XML RPC API using Java?

Jean-Yves Kiger August 25, 2011

Hello,

I would like to develop a java application to store confluence content. I would like to use the XML-RPC API, but i hardly understand how i am supposed to use it.

I tried this code:

import java.net.URL;

import redstone.xmlrpc.XmlRpcFault;

import redstone.xmlrpc.XmlRpcProxy;

public class FIRSTCLASS {

static interface Confluence {

public String login(String username, String password)

throws XmlRpcFault;

public void logout(String loginToken) throws XmlRpcFault;

}

public static void main(String[] args) {

try {

URL url = new URL("https://dev.companyName.com/rpc/xmlrpc/");

Confluence confluence1 = (Confluence) XmlRpcProxy.createProxy(url,

new Class[] { Confluence.class }, true);

String token = confluence1.login("myConfluenceUserName",

"myConfluencePassWord");

confluence1.logout(token);

} catch (Exception e) {

e.printStackTrace();

}

}

}

but I get this exception:

redstone.xmlrpc.XmlRpcException: The response could not be parsed.

at redstone.xmlrpc.XmlRpcClient.handleResponse(Unknown Source)

at redstone.xmlrpc.XmlRpcClient.endCall(Unknown Source)

at redstone.xmlrpc.XmlRpcClient.invoke(Unknown Source)

at redstone.xmlrpc.XmlRpcProxy.invoke(Unknown Source)

at $Proxy0.login(Unknown Source)

at FIRSTCLASS.main(FIRSTCLASS.java:23)

Caused by: java.io.FileNotFoundException: https://dev.companyName/rpc/xmlrpc/

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)

... 6 more

I checked with our confluence administrator, and the plug in RPC seems to be activated... do you have any idea about what I am missing? Given that when I use confluence I use the following url : https://dev.companyName.com/wiki/dashboard.action#
Thank you for your answers, and my apologies for approximative english and possibly stupid question.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Azwandi Mohd Aris
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 25, 2011

Try with this URL instead - https://dev.companyName.com/wiki/rpc/xmlrpc/ (you need the context path "/wiki" as well)

Jean-Yves Kiger August 25, 2011

I got the same exception with the wiki/ may it come from a bad instalation of the RPC pugin?

Jean-Yves Kiger August 25, 2011

Ok, i enventually retried with the added wiki/ (and not wiki// as i did the first time...) and it works. Thank you very much.

TAGS
AUG Leaders

Atlassian Community Events