import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
/**
* An example which illustrates token-based authentication, wrapping a simple
* reporting method that returns the names of all projects on a Pulse server.
*
* The main method outputs the project names, one per line.
*/
public class GetAllProjectNames
{
private static final String PULSE_URL = "http:;
private static final String USERNAME = "user";
private static final String PASSWORD = "secret";
public static void main(String[] argv) throws MalformedURLException, XmlRpcException
{
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(PULSE_URL));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
String token = (String) client.execute("RemoteApi.login", Arrays.asList(USERNAME, PASSWORD));
Object[] projectNames = (Object[]) client.execute("RemoteApi.getAllProjectNames", Arrays.asList(token));
client.execute("RemoteApi.logout", Arrays.asList(token));
for (Object projectName: projectNames)
{
System.out.println(projectName);
}
}
}