xml-xindice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Kenneth Collins" <u4125...@anu.edu.au>
Subject Re: Basic Authentication with Tomcat
Date Thu, 24 Jun 2004 05:53:07 GMT

> > Last Point "Configure Xindice XML-RPC Driver (Client side)" What do i
> > have to do where?!


> Please read Wiki entry:
>     This can be done with system properties ... or programmatically.

> Details are here:

> http://xml.apache.org/xindice/api/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.html


> Vadim


Hi Vadim,

I too have had trouble setting programmatic authentication for xindice.

Xindice 1.1b4 was up and running with no problems.  I had set up Cocoon's
cforms to write data to the xindice database using flowscript/xupdate.  It
was accessing the database over xmldb:xindice://localhost:8080/db.

The problem came when I enabled Tomcat's BASIC authentication on the
xindice directory, as recommended in the wiki entry
(http://wiki.apache.org/xindice/BasicAuthentication)

You recommend the code:

  driver.setProperty(DatabaseImpl.PROP_XMLRPC_USER, "xindice");
  driver.setProperty(DatabaseImpl.PROP_XMLRPC_PASSWORD, "manager");

However, driver is a protected field of DatabaseImpl
(http://xml.apache.org/xindice/api/org/apache/xindice/client/xmldb/DatabaseImpl.html)
and PROP_XMLRPC_[USER|PASSWORD] are private fields of DatabaseImpl
(http://cvs.apache.org/viewcvs.cgi/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.java?view=markup).

Trying to work around this, I set up some test code that included:

  try {
    String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
    Class c = Class.forName(driver);

    Database database = (Database)c.newInstance();
    DatabaseManager.setProperty(
      "xmlrpc-password", "...");
    DatabaseManager.setProperty(
      "xmlrpc-user", "xindice");

    DatabaseManager.registerDatabase(database);
    String uri = "xmldb:xindice://localhost:8080/db";

    col = DatabaseManager.getCollection(uri, "xindice", "..."); //
username, password

    assert col != null;
  } ...

I believed that DatabaseManager would pass on the properties to
DatabaseImpl (the xml-rpc version), which would then pass them on to the
XmlRpcClient, but the output I get is

  trying to register database
  XML:DB Exception occured (error code: 0)
org.xmldb.api.base.XMLDBException: Cannot communicate with the server:
http://localhost:8080/xindice

Looking through the code
(http://cvs.apache.org/viewcvs.cgi/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.java?view=markup),
I found the comment

  /* TODO: introduce authentication some day */

Yet the code seems to be present

  XmlRpcClient client = new XmlRpcClient(xmlRpcURL);
  if (basicUser != null) {
    client.setBasicAuthentication(basicUser, basicPassword);
  }
  return client;

Could you please give me some guidance on this?

If you need any more specifics, let me know.

Thanks,

Matt




Mime
View raw message