ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Javier Espinazo Pagán <>
Subject Problem with Basic Authentication
Date Fri, 11 Nov 2011 12:33:12 GMT

I am trying to authenticate a client against a Trac XML-RPC server
using the following code, which does a simple request:

package es.modelum.migration.mylyn.trac;


import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.lustin.trac.xmlprc.Ticket;
import org.lustin.trac.xmlprc.TrackerDynamicProxy;

import tasks.Task;

public class TracInitializer {
	XmlRpcClient rpcClient = new XmlRpcClient();
	TrackerDynamicProxy rpcProxy;
	public TracInitializer(String serverURL, String username, String
password) throws MalformedURLException {
		XmlRpcClientConfigImpl rpcConf = new XmlRpcClientConfigImpl();
		rpcConf.setServerURL(new URL(serverURL));
		rpcProxy = new TrackerDynamicProxy(rpcClient);
	public void getTicket(int ticketID) {
		Ticket ticket = (Ticket)rpcProxy.newInstance(Ticket.class);		
	public void createTicket(Task task) {
	static public void main(String[] args) {
		try {
			TracInitializer tracInitializer = new
TracInitializer("", "user", "pass");
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block

However, when the request ticket.getTicketFields() is called, I get
the following exception:

Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
	at $Proxy0.getTicketFields(Unknown Source)
	at es.modelum.migration.mylyn.trac.TracInitializer.getTicket(
	at es.modelum.migration.mylyn.trac.TracInitializer.main(
Caused by: org.apache.xmlrpc.XmlRpcException: Failed to create input
stream: Server returned HTTP response code: 401 for URL:
	at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.getInputStream(
	at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(
	at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(
	at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(
	at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(
	at org.apache.xmlrpc.client.XmlRpcClient.execute(
	at org.apache.xmlrpc.client.XmlRpcClient.execute(
	at org.apache.xmlrpc.client.XmlRpcClient.execute(
	at org.lustin.trac.xmlprc.TrackerDynamicProxy$1.invoke(
	... 3 more

User and password are correct and the server answers XML-ROC requests
correctly from the Mylyn Trac connector. I found an old archived
thread with a similar problem
but the author didn't provide his solution to the problem.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message