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

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
and PROP_XMLRPC_[USER|PASSWORD] are private fields of DatabaseImpl

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();
      "xmlrpc-password", "...");
      "xmlrpc-user", "xindice");

    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:

Looking through the code
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.



View raw message